last day (14 days later) » 

10:16 AM
0
A: How to create a instance of UserCredential if I already have the value of Access Token?

NkosiAssuming you already have the tokens you can do the following string[] scopes = new string[] { PlusService.Scope.PlusLogin, PlusService.Scope.UserinfoEmail, PlusService.Scope.UserinfoProfile }; var flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer { ...

 
Just a follow up question @Nkosi how to set the refresh token in UserCredential? credential.Token.RefreshToken = "[your_access_token_here]" is that the right way? Because I kept getting "The access token has expired but we can't refresh it".
 
@PrinceJea. check update
@PrinceJea. You include the refresh token when you create the TokenResponse. GoogleAuthorizationCodeFlow will get a new access token based on your refresh token and client secrets.
 
how to get the refresh token exactly? This is what I've tried context.Identity.AddClaim(new Claim("urn:google:refreshtoken", context.RefreshToken, ClaimValueTypes.String, "Google")); I'm still getting errors.
 
Did you read any of the reference material I linked to? I think I quoted something in your other question stackoverflow.com/a/38432284/5233410
 
Yes I'm reading it for days lol. I'm just stuck on getting user circles right now. I've done it on facebook but the google api gave me headaches.
 
10:16 AM
OK. Do you get a refresh token when you authenticate your users?
 
Yes I've got the token
but it spawns another error "Invalid Credentials"
I double checked the keys its correct I dont know what I'm missing here
 
try it with just the refresh token and see if that works
as the access token may have already expired
 
I still got an error
This is where the code stops
PeopleFeed peopleFeed = listPeople.Execute();
 
10:32 AM
take a look at this answer stackoverflow.com/a/27166119/5233410
 
11:10 AM
Really appreaciate it Nkosi thanks a lot mate
 
Glad to help. Happy coding!!!. If my answers to your questions on SO were helpful you can vote them up.
 

last day (14 days later) »