![](/img/trans.png)
[英]Cognito Authorization with Azure AD SAML integration returns id_token and access_token but no refresh token
[英]id Token vs access_token google login api in web
我在使用 Google 登錄后使用access_token
,但 Google 登錄已更改,我正在嘗試將其用作id_token
。
我通過下面的現有代碼收到了email
和id
。
const userInfoClient = google.oauth2('v2').userinfo;
this.oauthClient.setCredentials({
access_token: tokenData.token,
});
const userInfoResponse = await userInfoClient.get({
auth: this.oauthClient,
});
修改后的代碼如下。 我通過有效負載接收各種值。 我需要email
和id
,但id
值不存在。 nbf
是否等於access_token
中的id
?
const ticket = await client.verifyIdToken({
idToken: tokenData.token,
audience: process.env.GOOGLE_CLIENT_ID,
});
有效載荷的值有 iss,nbf,aud,sub,email,azp,name,picture,iat,exp,jti
nbf
代表“Not Before”,它是一個時間戳,用於指定令牌不能使用的時間。 sub
表示“主題”,通常是您可能正在尋找的用戶 UID。 查看RFC 7519以了解有關 JWT 中存在的屬性的更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.