Betty Papagianni
Betty Papagianni

Reputation: 31

How to authenticate with a backend server?

Does anyone can help me to get a solution for authenticate with a backend server ? I am logging in in my platform with a google account and I post the id_token (using ajax).

var msg = $.ajax({type: "POST", url: "controller/action", data: token, async: false}).responseText;
if (msg=="ok"){
    window.location = "controller/action";
}
else {
    window.location = "controller/action";
}

Now, I want to authenticate the token in order to save user information (name, image,email) in database.
I see this https://developers.google.com/identity/sign-in/web/backend-auth. Is there a way to use it?

Upvotes: 2

Views: 543

Answers (1)

Vikas Jaiswal
Vikas Jaiswal

Reputation: 66

Send get Request in any RestClient and replace xyz with your token:-

https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=xyz

Once you get Response in restclient then simply assemble this get request in your convenient language. Get request in grails see this

hope it helps you

Upvotes: 1

Related Questions