OAuth.io

Simplified multi-providers authorization


OAuth


OAuth 2 Protocol

1 - redirection


www.facebook.com/dialog/oauth/authorize
client_id=...
response_type=code
scope=email,read_friendlists...
state=...


2 - authorize callback

http://monsite.com/?code=...&state=...


3 - Récupérer le token

POST graph.facebook.com/oauth/access_token

code=...
client_id=...
client_secret=...
grant_type=authorization_code


OAuth 2 Protocol

1 - redirection


client_id -> app_id=...
response_type=code [inutile]
scope -> perms=email,read_friendlists...
state=... [non documenté]


2 - authorize callback

http://monsite.com/?code=...&state=...


3 - Récupérer le token


code=...
client_id ->  app_id=...
client_secret -> secret=...
grant_type=authorization_code

OAUTH 2 PROTOCOL

(et aussi:)
  • access_token? oauth_token? Authorization Bearer? OAuth?
  • séparateurs = , : " "; | (etc.) un élément ou plusieurs ?
  • l'url de l'api est dans le retour de /access_token (salesforce)
  • une étape en plus (mailchimp)
  • une signature en plus (oauth 2 version russe)
  • une clé en plus (stackexchange)
  • une constante en plus (oauth_version=2.a)
  • state parfois inexistant / impossible
  • diverses variantes et combinaisons


Multi providers oauth


impossible à main nue


Oauth.io


 OAuth.popup('facebook', function(err, res) {
    if (err) {
        // do something with error
    }    // the access token is in res.access_token !
    res.get('/me')
       .done(function(data) {
        alert('Hello ' + data.name)
    })
})



OAUTH.IO


 OAuth.popup('twitter', function(err, res) {
    if (err) {
        // do something with error
    }    // the access token is in res.access_token !
    res.get('/1.1/account/verify_credentials.json')
       .done(function(data) {
        alert('Hello ' + data.name)
    })
})


OAUTH.IO


Android, iOS, Flex et Phonegap


Examples


Serverless twitter timeline


EXAMPLES


Synchro dropbox -> google drive



Thanks !


OAuth.io

By arnaud richard

OAuth.io

  • 3,306