google-signin: GoogleSignIn.getTokens() not returning new tokens in android
Once my token expires, I first call GoogleSignIn.clearCachedAccessToken(accessToken) and then call GoogleSignIn.getTokens(). However, I do not get a set of fresh tokens, rather I am provided with the same expired set of tokens.
Steps to Reproduce
Below is my refresh code function :-
export function refreshExpiredToken(exp,accessToken,dispatch){
return new Promise(async (resolve)=>{
if(moment().valueOf() > exp){
await GoogleSignin.clearCachedAccessToken(accessToken)
const tokens = await GoogleSignin.getTokens()
console.log(tokens)
}
resolve(true)
})
}
Expected Behavior
I expected to receive a new set of tokens, that has an expiry time 1 hour from the time getTokens() is called.
Actual Behavior
I receive the old set of tokens, that have already expired.
Environment
@react-native-community/google-signin: ^4.0.3
System:
OS: Windows 10 10.0.18363
Languages:
Java: javac 11
Python: 3.8.5
npmPackages:
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 17
FYI, I was having the same issue, and fixed by using the following code:
(credits: https://github.com/react-native-google-signin/google-signin/issues/792#issuecomment-816821710)
Still looks to be an ongoing issue
Please help me I get access from a google user but I need a refresh token I can get please give me proper any docs or solutions in react native