📜 ⬆️ ⬇️

OAuth.io

Good day and with the past Day of national unity! I want to tell about one good project -.


OAuth.io is an API ( JavaScript , PhoneGap , iOS , Android , Flex ) and a service that greatly simplifies interaction with more than 80 oAuth providers (Facebook, Twitter, VK, GitHub, Dropbox, and others). The service works according to the freemium model: up to 5,000 connections per month, the service is free, with a larger number you expect quite reasonable prices . It is also worth saying that the project is completely open and you can run the server side of OAuth IO Daemon ( GitHub ) yourself .


Register and create an application in OAuth.io:

image
')
Creating an application on Facebook, the domain and URL for callback will be oauth.io and oauth.io/auth oauth.io/auth respectively:

image

We set up Facebook by specifying the generated App ID and App Secret:

image

And everything works:



Javascript


We connect the library:
 <script src="/path/to/OAuth.js"></script> 

We initialize our application:
 OAuth.initialize('Public key'); //   oAuth.io 

We get the token :
Pop-up window:

 OAuth.popup('facebook', function(err, result) { //handle error with err //use result.access_token in your API request }); 

Redirect:

 //Using redirection (option 2) OAuth.redirect('facebook', "callback/url"); OAuth.callback('facebook', function(err, result) { //handle error with err //use result.access_token in your API request }); 

Working example

Thank you all for your attention!

Source: https://habr.com/ru/post/200812/


All Articles