Support Topics Documentation Slack YouTube Blog

Sign in error through Google

Hello everyone, I used Backendless.UserService.loginWithGooglePlus() to sign in through Google and it works. But I noticed in the console that this function will be deprecated and and you need to use it Backendless.UserService.loginWithGooglePlusSdk(). Here is added sdk at the end.

My problem: this function give 3 params: accessToken, fieldMapGoogle, stayLoggedIn. What kind of access token, or rather where to get it from? There is not a word in the documentation about this function
Thanks!

Hello @LEV_VOROBEV

Thank you for your request, I’ve created an internal ticket to check the doc, the ticket number for reference is BKNDLSS-20971

Yes, we are going to remove the next signatures:

function loginWithFacebook(fields?: Object, permissions?: Object, stayLoggedIn?: boolean): Promise<void>;
function loginWithFacebookSdk<T = Backendless.User>(fields?: Object, stayLoggedIn?: boolean): Promise<T>;
function loginWithGooglePlus(fields?: Object, permissions?: Object, container?: HTMLElement, stayLoggedIn?: boolean): Promise<void>;
function loginWithGooglePlusSdk<T = Backendless.User>(fields?: Object, stayLoggedIn?: boolean): Promise<T>;

there are will be available only this methods:

function loginWithFacebookSdk<T = Backendless.User>(accessToken: String, fields: Object, stayLoggedIn?: boolean): Promise<T>;
function loginWithGooglePlusSdk<T = Backendless.User>(accessToken: String, fields?: Object, stayLoggedIn?: boolean): Promise<T>;

You are able to receive an accessToken from Google/Facebook using any libraries/SDKs you want and then pass it as the first argument to the loginWith<Facebook|Google>SDK

take a look at our code sample in the JS-SDK by the following links:

Regards, Vlad

Thank you fro answer
I don’t understood what is

You are able to receive an accessToken from Google/Facebook using any libraries/SDKs you want

Where I can take this token and what kind of libraries/SDKs you mean?

I mean to use FacebookSKD/GoogleSDK

for instance, to get accessToken from FacebookSDK you can use

      FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
var accessToken = response && response.authResponse && response.authResponse.accessToken;
      
            // here Backendless.Users.loginWithFacebookSdk(accessToken)
        } else {
          FB.login(function(response) {

var accessToken = response && response.authResponse && response.authResponse.accessToken;

            // here Backendless.Users.loginWithFacebookSdk(accessToken)
          }, fbLoginOptions);
        }
      });

I spend a hour for solve my problem but I not solved. Without examples it is nothing. Why you show me about FB, if I asked Google? Why your doc is uncomplete?

have you opened provided links above?
There is an example how to retrieve accessToken from GoogleSDK

 gapi.auth.authorize({
        client_id: GOOGLE_CLIENT_ID,
        scope    : "https://www.googleapis.com/auth/plus.login"
      }, function(response) {
        var accessToken = response && response.access_token;

        /// here  Backendless.UserService.loginWithGooglePlusSdk(accessToken)
      });

Thanks a lot!