我使用以下信息创建了 OAuth 2.0 Playground 访问令牌:
选择和授权 API:https ://www.googleapis.com/auth/consumersurveys https://www.googleapis.com/auth/userinfo.email
这有效(对我来说,它返回我之前创建的调查列表)。
但是,当我使用 Postman 创建访问令牌或从 AspNetUserClaims 表中检索它们时,这些访问令牌不起作用。
示例 #1:我在 Postman for Google 中获得了一个访问令牌并将其添加到 Header(承载和令牌出现复选标记)。我在 Postman 中按 Send,它返回“Invalid_Credentials”。如果令牌过期或无效,我会删除它并创建一个新的以在标头中使用。仍然失败。
POSTMAN info:
Auth URL: https://accounts.google.com/o/oauth2/auth
Access Token URL: https://accounts.google.com/o/oauth2/token
Client ID: hidden
Client Secret: hidden
Scope: https://www.googleapis.com/auth/userinfo.email
Grant Type: Authorization Code
Request access token locally is checked.
示例 #2:我使用开发站点上的 Google 登录按钮生成访问令牌,然后将其存储在 AspNetuserClaims 表中。我将该访问令牌复制到 Postman(也出现复选标记)并按发送,它也返回“Invalid_Credentials”。如果令牌过期,我会从所有 AspNet 用户表中删除新创建的帐户和访问令牌,然后重试。仍然失败。
为什么这仅适用于 Postman 中的 OAuth 2.0 Playground 令牌?它们都是通过 Postman 令牌向导或新注册的用户帐户或 OAuth2.0 Playground 向导新生成的令牌,但实际上只有 OAuth2.0 Playground 令牌有效......