Testing OAuth2 with Facebook Connect
Published 2015-2-2A lot of people don't know this, but local web development gets a lot easier when you have a few dummy domains to work with.
127.0.0.1
, localhost
, and file://
urls all have limitations that
you'll run into sooner or later.
For that reason (and for you testing pleasure),
I maintain a number of local.
domains
(one for pretty much every domain I own)
and I also have a few
dummy facebook apps so that I can test other people's examples
(and create zero-config examples).
It's also beneficial to be able to test cross-domain, cross-security, and cross-app interactions. For that I provide 2 examples using HTTPS (one with real certificates) and 1 with HTTP.
Zero-Config Examples
For SSL see https://github.com/coolaj86/nodejs-ssl-example.
For OAuth2 with Facebook see https://github.com/LDSorg/passport-lds-connect-example.
If you're creating your own example, feel free to test with these real, live, working dummy keys:
Non-local Demos
You can edit /etc/hosts
on your local computer as well as on your server
so that you can test with my dummy keys even when you're don't want to run
on localhost.
For example:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.1.100 local.foobar3000.com
192.168.1.101 local.helloworld3000.com
192.168.1.102 local.ldsconnect.org
TODO: I've got a sneaky dns service on my todo list that might make this process even simpler (personalized dyndns). Remind me if I haven't posted back about it in a few months. One of my current projects requires it, so it's gonna get done.
OAuth2 (Facebook Connect)
OAuth2 Param | Value |
---|---|
Authorization URL | https://www.facebook.com/dialog/oauth |
Token URL | https://graph.facebook.com/oauth/access_token |
Profile URL | https://graph.facebook.com/me |
Dummy API Keys
Because sometimes you just want crap to work without any work on your part.
https on 4443 - local.helloworld3000.com
OAuth2 Param | Value |
---|---|
App ID | 348857075306303 |
App Secret | 77f867db98699c27940c97aeee936bb6 |
Callback URL | https://local.helloworld3000.com:4443 |
http on 4080 - local.foobar3000.com
OAuth2 Param | Value |
---|---|
App ID | 746913342088510 |
App Secret | ad539732cbfbd60169f32336e257b37c |
Callback URL | http://local.foobar3000.com:4080 |
https on 8043 - local.ldsconnect.org
OAuth2 Param | Value |
---|---|
App ID | 1592518370979179 |
App Secret | dd067af5becc203524507dba86eb3020 |
Callback URL | https://local.ldsconnect.org:8043 |
Actual SSL certificates for local.ldsconnect.org:
For some webservers you are required to concatonate all of the
*.crt.pem
files into a single bundle.crt.pem
,
others require them separate.
By AJ ONeal
Did I make your day?
Buy me a coffee
(you can learn about the bigger picture I'm working towards on my patreon page )