-
Notifications
You must be signed in to change notification settings - Fork 230
Open
Description
hi;
thank you for your great post and sample code.
but I am a bit frustrated replicating this for Google.
how can I check and verify the token that we got from our angular app?
in this part
// 1.generate an app access token
var appAccessTokenResponse = await Client.GetStringAsync($"https://graph.facebook.com/oauth/access_token?client_id={_fbAuthSettings.AppId}&client_secret={_fbAuthSettings.AppSecret}&grant_type=client_credentials");
var appAccessToken = JsonConvert.DeserializeObject<FacebookAppAccessToken>(appAccessTokenResponse);
// 2. validate the user access token
var userAccessTokenValidationResponse = await Client.GetStringAsync($"https://graph.facebook.com/debug_token?input_token={model.AccessToken}&access_token={appAccessToken.AccessToken}");
var userAccessTokenValidation = JsonConvert.DeserializeObject<FacebookUserAccessTokenValidation>(userAccessTokenValidationResponse);
if (!userAccessTokenValidation.Data.IsValid)
{
return BadRequest(Errors.AddErrorToModelState("login_failure", "Invalid facebook token.", ModelState));
}
// 3. we've got a valid token so we can request user data from fb
var userInfoResponse = await Client.GetStringAsync($"https://graph.facebook.com/v2.8/me?fields=id,email,first_name,last_name,name,gender,locale,birthday,picture&access_token={model.AccessToken}");
var userInfo = JsonConvert.DeserializeObject<FacebookUserData>(userInfoResponse);
// 4. ready to create the local user account (if necessary) and jwt
how can I implement these 4 steps for google?
I used every method described in google OAuth document but there was no luck.
I'll be grateful if you help me with this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels