Android sample app -- unable to authenticate with Facebook

We have a new account and are trying to use the sample app as a test of the SDK vs native Facebook login functionality. We have a pair of Facebook applications we are testing with. I'm not sure how their settings differ, but here is the result with the two apps. (FB AppID 2 is the main one we're trying to use; I included AppID 1 just for troubleshooting/comparison purposes.)

FB AppID 1: Click on either SDK or Native login button and get a Facebook popup with the error: "Not logged in. You are not logged in. Please log in and try again."

FB AppID 2: Click on either SDK or Native login button and get a Facebook login popup asking user to log in to the application, with the correct application name. After successful login, I see a conversation like this in the Android debug logs:

:: --- HTTP PUT https://[subdomain].api.oneall.com/users.json
:: Content-Type: application/json; charset=UTF-8
:: Content-Length: 293
:: {"request":{"user":{"action":"import_from_access_token","identity":{"source":{"access_token":{"key":"[long access token here]"},"key":"facebook"}}}}}
:: --- END HTTP (293-byte body)
:: Not sending keepalive. Current connection state=STOPPED
:: --- HTTP 400 https://[subdomain].api.oneall.com/users.json (454ms)
:: : HTTP/1.1 400 Bad Request
:: {"response":{"request":{"date":"Thu, 14 Jul 2016 16:38:52 +0200","resource":"\/users.json","status":{"flag":"error","code":400,"info":"The provider did not accept the access_token, either the key\/secret combination is wrong or the token is expired."}}}}
:: --- END HTTP (254-byte body)

Nothing appears in the sample app's User Info box because of the failed provider call. I can successfully authenticate using Twitter and get back information about the user.

Is this an issue with the configuration of the FB application? Thanks for any help.

Best Answer

Answers

  • I've actually been able to recreate this with the web API. I go to the initial URL in a browser, initiate the Facebook login process, get back an access_token via the callback, and use that to get user data. Here's the JSON I'm submitting in the PUT request:

    {"request":{"user":{"action":"import_from_access_token","identity":
    {"source":{"access_token":{"key":"aaaaaaaa-aaaa-aaaa-bd93-9174e0ef7927"},"key":"facebook"}}}}}

    I get back the same message about "The provider did not accept the access_token, either the key/secret combination is wrong or the token is expired." What am I missing?
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Hi Ben,

    The provider did not accept the access_token, either the key/secret combination is wrong or the token is expired.

    If you get this error then it's very likely that you are authenticating the user with a Facebook app that is different from the app that you have entered in the Facebook setup in your OneAll account.

    Could you please compare the Facebook app ID that you are using for authentication with the Facebook app ID in your OneAll account and make sure that they are the same?
  • I'm not sure if this would be the case, as I can reproduce the issue from the web. I start with this URL:

    https://[subdomain].api.oneall.com/socialize/connect/mobile/facebook/?nonce=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee&callback_uri=http://localhost/callback

    I go through the FB login process and get redirected here:

    http://localhost/callback?oa_action=social_login&oa_connector=mobile&connection_token=aaaaaaaa-6808-4021-8216-417072514258#_=_

    I then use that token to make the "import_from_access_token" API call, which returns the "did not accept the access_token" message. Is this not the right workflow for the web API?
  • I am probably mixing something up. I was running the import_from_access_token API call with a 32-character connection token I got from the callback. However, using the User Token Lookup tool in the Developers' Corner I get a connection_token that's 163 characters long, and if I use that in the API call I successfully get back my user data. Is the connection_token in the callback not the same as the one I should be passing through to the API?

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.