我正在我的React-Native应用中实施google api,并使用react-native-google-signin包进行google登录/ oauth。
使用代码时
GoogleSignin.configure({
scopes: ["https://www.googleapis.com/auth/drive.readonly"], // what API you want to access on behalf of the user, default is email and profile
iosClientId: <FROM DEVELOPER CONSOLE>, // only for iOS
webClientId: <FROM DEVELOPER CONSOLE>, // client ID of type WEB for your server (needed to verify user ID and offline access)
offlineAccess: true // if you want to access Google API on behalf of the user FROM YOUR SERVER
hostedDomain: '' // specifies a hosted domain restriction
forceConsentPrompt: true // [Android] if you want to show the authorization prompt at each login
accountName: '' // [Android] specifies an account name on the device that should be used
})
.then(() => {
// you can now call currentUserAsync`enter code here`()
});
虽然我有 offlineAccess:true ,但我仍然没有获得在原始令牌过期后使用的刷新令牌。如何使用此包获取刷新令牌?或者当令牌过期时该怎么办?我的服务是安静的后台工作人员,无法通过提供UI来询问用户凭据。