Google login with Rest API

Hello,
I’m trying to log in with google and Rest Api. I choose the way with the SDK Provider. All is fine, I receive the idToken from Google. Now I want to use the OAuth endpoint to exchange my token with a backendless token and login.

I launch this endpoint with POST method

MYAPP/api/users/oauth/googleplus/login

I have this error:

{
    "code": 3109,
    "message": "GUID: 29BFAAE2-30BA-4C18-8778-E667181D67A3\n Error during obtaining user data.\n Response from OAuth2 provider server: Unauthorized\n{\n  \"error\": {\n    \"code\": 401,\n    \"message\": \"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.\",\n    \"status\": \"UNAUTHENTICATED\"\n  }\n}\n",
    "errorData": {}
}

I have seen a topic on this support which suggest to use the redirect URL, but I want to keep the SDK Provider. There is a new way to handle google sign in with credential.

This is my body I send

{
    "accessToken":"myToken"
}

Do I need to send this token as a Bearer too? Why this call didn’t work?

Thanks you

Hi @Indevers

We are currently looking into your issue and will answer as soon as possible

Regards,
Zahar

Also, provide your application ID please

My application ID is : 6BBA55A8-087F-EBA2-FF1B-596EB5335600

1 Like

Unfortunately, there is no other way but to use the approach described in the documentation. Therefore, please try to add a redirect URL.

Regards,
Zahar

Ok so if I use the method with the redirect url I can’t use the sdk provider, right?

I guess you can use sdk provider
You can read more about logging in with the provider’s SDK here Initial Configuration - Login With Provider’s SDK

ok maybe we didn’t understand each other. The redirection url you’re talking about, where did you put it? That’s what I didn’t understand. Because I’ve followed the whole tutorial, when I implement the login with the sdk provider, I get the token back, but it’s the OAuth2 Login API that doesn’t seem to be working.

Do you have the same thing at your level or does it work?

you should put it here If I understand you correctly