2

inline

All the tutorials for the chrome extension with FB Oauth login is to use chrome.identity.getRedirectURL()

But it doesn't make sense at all. Because FB OAuth not allow wildcard in the redirect url. and chrome.identity.getRedirectURL() will change everytime.

Even I point the redirect url to my Rails server.

I could only get the redirect url without any valid token.

params
=> <ActionController::Parameters {"redirect"=>"https://daeooffnjhgchmfmebclagekadcdalhm.chromiumapp.org/", "format"=>"json", "controller"=>"api/v1/query_words", "action"=>"fbLogin"} permitted: false>

>

var CHROME_POPUP_URL = chrome.identity.getRedirectURL();
var FACEBOOK_LOGIN_SUCCESS_URL= 'https://638b5bb3.ngrok.io/api/v1/fbLogin?redirect='+encodeURIComponent(CHROME_POPUP_URL);
var BASE = 'https://www.facebook.com/v2.8/dialog/oauth?'
var FACEBOOK_OAUTH_URL = BASE+'response_type=code%20token' +'&client_id='+clientID+'&redirect_uri='+CHROME_POPUP_URL+'&scope='+FACEBOOK_PERMISSIONS;


        let params = {
            url: FACEBOOK_OAUTH_URL,
            interactive: true
        }
        console.log(params)
        chrome.identity.launchWebAuthFlow(
            params
newBike
  • 14,385
  • 29
  • 109
  • 192
  • Try to check this [tutorial](https://developers.facebook.com/docs/facebook-login) if it can help you to authorize your application with Facebook. Just check the Advanced tab to check how to manually build a login flow. Also, check this [SO question](http://stackoverflow.com/questions/21312547/how-get-facebook-token-using-oauth2-with-chrome-identity) if it can help you. – KENdi Mar 07 '17 at 12:24

0 Answers0