Everlive (login with facebook)

6 posts, 0 answers
  1. Predrag
    Predrag avatar
    4 posts
    Member since:
    Jan 2015

    Posted 09 Apr 2015 Link to this post

    I have a problem with Facebook login. When I use

     

    var accessToken = "XXXXXXXXXX";
    Everlive.Users.loginWithFacebook(accessToken,
                    function (data) {
                      //code
                    },
                    function (error) {
                        //code
                    });

     I get this error:
    message: "Cannot retrieve a user for the specified token.", code: 217

    accessToken is correct because I don't have any problem when I use FB API for login.

     Facebook is enabled in telerik platform and.

     

    Do you have any suggestions?

     

  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 09 Apr 2015 Link to this post

    Hi Predrag,

    This error is explained here - http://docs.telerik.com/platform/backend-services/development/rest-api/error_codes. It is usually returned when the token passed as Facebook token is not a valid one before the FB API. As you can see in this article the backend server will try to reach the FB API with the provided token and verify the user's identity. If this step fails the above error is returned to the client.

    Could you please double check the token and its format, perhaps the data might be truncated or the token might be expired. Otherwise, you should not experience such error.

    Also, could you trace the request sent to the server and the data in it? It should be a POST request to the  /Users endpoint with the following body:
    {
        "Identity": {
            "Provider": "Facebook",
            "Token": "your-facebook-token-here"
        }
    }

    where your-facebook-token-here is the actual FB token. Examining the request may shed some light on the issue.

    Let me know if further questions arise.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  3. Almir
    Almir avatar
    4 posts
    Member since:
    May 2009

    Posted 11 Apr 2015 in reply to Anton Dobrev Link to this post

    Tocken is OK. I have a same problem with Twitter.

  4. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 14 Apr 2015 Link to this post

    Hi,

    I tried to investigate the issue on our side but to no avail.

    Could you please observe the body of the request sent to the server that returns the error?

    Optionally, we will appreciate if you could share a sample code that reproduces the issue, no need to include the Facebook App Id and API key. Also, the settings of your FB app would be helpful. You may also share this information in a private support ticket.

    I look forward to your reply.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  5. Predrag
    Predrag avatar
    4 posts
    Member since:
    Jan 2015

    Posted 20 Apr 2015 in reply to Anton Dobrev Link to this post

    this is requests for FB i Twitter

     this is my code

    var accessToken = "XXXXXXXXXX";
    Everlive.Users.loginWithFacebook(accessToken,
                    function (data) {
                      console.log(data);
                    },
                    function (error) {
                       console.log(error);
                    });

  6. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 23 Apr 2015 Link to this post

    Hi Predrag,

    Thanks for providing this information.

    Indeed, the request made to the API seems correct. What it appears to be a concern is that both the FB and Twitter tokens appear to be very short in terms of length (I do understand that you edited the body of the token). This leads me to believe, that the token was not properly obtained hence the error.

    We'd like to ask you to:

    - Check your Facebook app with the Friends sample application. To do this, just map the values in the FB settings in app/settings.js with your FB APP ID.
    - Test the Twitter authentication - use the Access Token and Access Token secret for your app located under the https://apps.twitter.com/ settings and call el.Users.loginWithTwitter(accessToken, tokenSecret, cb, ecb); with this hard-coded parameters.

    The above steps are needed in order to ensure that the API for social login of users works properly for you.

    I am afraid that until we are able to reproduce the issue locally we could not be of any further guidance. That is why I'd suggest that you submit a private support ticket (under the Almir Music account) and provide a runnable sample that illustrates the issue. The crucial in this case would be to scrutinize the logic that obtains a token on behalf the user after the user consent is granted.

    I look forward to your reply.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top