This is a migrated thread and some comments may be shown as answers.

Facebook Access Token

3 Answers 129 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Noel
Top achievements
Rank 1
Noel asked on 23 Sep 2013, 03:24 PM
I used the code from the sample Facebook app to allow users to connect to their Everlive account through facebook. After the user type in his/her username/password, the screen is stuck at the "success" white browser page. i.e. the Childbrowser did not close.

I have tried tracing the problem and it seems like the function below is not returning the access_token. It is always equal to -1. When the sample app first launch, this function worked fine (it got the access token from facebook). Now it doesn't. Any reason why this is the case? 

ref.addEventListener('loadstop', function(event) {
that.locationChanged(event.url, callback);
});

3 Answers, 1 is accepted

Sort by
0
Viktor Staikov
Telerik team
answered on 24 Sep 2013, 04:22 PM
Hello,

From your email it looks like the problem is with Facebook login. The access token is provided by their server, so this might be caused by issue with servers or missconfiguration in you app. What happens when you create new application from the same template and try to login with Facebook again?

Please, bear in mind that the client_id used for authentication is hardcoded in the template, so I it's better to register your own Facebook application and use new client_id.

Regards,
Viktor Staikov
Telerik

Big news for mobile app and .NET developers! Hear about it at our Release Keynote. Thursday, September 26th, 11AM EDT
Do you enjoy Icenium? Vote for it in Windows IT Pro Community Choice Awards as Best Cloud Computing Product or Service (Category 5).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Ajay
Top achievements
Rank 1
answered on 07 Mar 2014, 02:56 PM
Hello viktor,
how to get the client_id.
and what do u mean by this " better to register your own Facebook application and use new client_id".

Thanks
0
Anton Dobrev
Telerik team
answered on 10 Mar 2014, 11:57 AM
Hello Anup,

In order to use the 'social' authentication providers, the respective providers require that you have a registered app with them. When such is registered, the social providers will issue an App ID (Facebook), Client ID (Google, Live), Consumer key and Consumer secret (Twitter). In the AppBuilder's "sample-facebook-api", the client_id must be set with the value of the App ID.

In order to use social authentication for a Telerik Backend Services project, you can use an AppBuilder Friends sample project. Also, you can refer to the Telerik Backend Services "Hybrid Friends sample app" and "Hybrid OAuth sample app" available for download here. Please, note that in order to authenticate users from OAuth providers in a Telerik Backend Services project, this feature should be enabled via the 'User authentication' tab from the "Settings" menu. In addition, the 'Social login' feature in Telerik Backend Services is subject to a 'Professional' tier subscription or higher.

Below are some instructions on how to register App ID/Client IDs with social providers.

Facebook

  • Go to https://developers.facebook.com/ > Apps > Create new app. Note that there is no need to target a concrete platform(Web, iOS, Android, etc.) in order to test the social login feature of the project.
  • Enter the provisioned by Facebook App ID into settings.js (for the "AppBuilder Friends project") or into main.js (for the "sample-facebook-api" project).
  • Leave the redirectUri to point out to 'https://www.facebook.com/connect/login_success.html'.

Google

  • Go to https://cloud.google.com/console/project > Create project.
  • After the project is created choose APIs and auth > Credentials > Create Client ID for web application from the left navigation pane
  • Set the Redirect URIs to, for example: http://localhost
  • Enter the client ID into the AppBuilder project and make sure that the redirectUri matches the Redirect URIs entered into the credentials input.

Live ID

  • Head to https://account.live.com/developers/applications/index
  • Create an application and check the 'Yes' radio button for Mobile client app.
  • Enter the Client ID in the 'Friends' project's settings.js and make sure that the redirectUri points to 'https://login.live.com/oauth20_desktop.srf'.

Also, you can review Telerik Backend Services documentation section on this topic.

The official developer documentation for the OAuth providers is available at the following links:


Regards,
Anton Dobrev
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Tags
General Discussion
Asked by
Noel
Top achievements
Rank 1
Answers by
Viktor Staikov
Telerik team
Ajay
Top achievements
Rank 1
Anton Dobrev
Telerik team
Share this question
or