简体   繁体   English

使用 AWS Cognito 托管 UI(代码授权)验证后,我该如何处理令牌? 后续 API 调用没有令牌

[英]Using AWS Cognito Hosted UI (Code Grant) what do I do with the token once it is verified? Subsequent API Calls do not have the token

MY goal is to setup the Cognito Hosted UI to validate users after login.我的目标是设置 Cognito Hosted UI 以在登录后验证用户。 I have followed the steps laid out in the OAuth2 blog here: https://developer.okta.com/blog/2018/04/10/oauth-authorization-code-grant-type我已按照 OAuth2 博客中列出的步骤操作: https : //developer.okta.com/blog/2018/04/10/oauth-authorization-code-grant-type

My steps are as follows.我的步骤如下。

  1. User logs into the AWS provided login screen.用户登录 AWS 提供的登录屏幕。
  2. It redirects to my website and I pull down the authorization code in Angular.它重定向到我的网站,我在 Angular 中拉下授权代码。
  3. I send the code as part of my headers to the backend Nodejs我将代码作为标头的一部分发送到后端 Nodejs
  4. I use the code to get a token and then validate the token我使用代码获取令牌,然后验证令牌

This stream works but then what?这个流有效,但是然后呢? I want to validate the AWS token for each API call but I have no idea how to access the token.我想为每个 API 调用验证 AWS 令牌,但我不知道如何访问令牌。

I am guessing that I am either missing the point of this procedure or that the token is somewhere I am unaware of.我猜我要么错过了这个过程的重点,要么令牌在我不知道的地方。

Any help would be greatly appreciated.任何帮助将不胜感激。

Usually you have your own UI that redirects to Cognito to authenticate, after which the UI sends the access token to the API on every request.通常,您有自己的 UI,该 UI 重定向到 Cognito 进行身份验证,之后 UI 会在每次请求时将访问令牌发送到 API。

All of the code samples on my Quick Start Page work like this and use Cognito.我的快速入门页面上的所有代码示例都像这样工作并使用 Cognito。

If it helps, this is what the OAuth Technical Messages look like.如果有帮助,这就是OAuth 技术消息的样子。 Feel free to ask any follow up questions随时提出任何后续问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在API中使用Cognito令牌? - How do I use a Cognito token with API? 不使用托管 UI 的 AWS Cognito 授权代码授权流程 - AWS Cognito Authorization code grant flow without using the hosted UI Amazon Cognito:验证用户身份后,是否必须提示他们登录? - Amazon Cognito: Once a user is verified do they have to be prompted to sign in? 我是否需要在 Lambda 和 API 网关中验证 AWS Cognito 令牌? - Do I need to verify a AWS Cognito token in BOTH Lambda AND as API Gateway? Alexa 帐户链接 - 如果链接的访问令牌已过期怎么办? 我正在使用隐式授权流程 - Alexa Account Linking - What to do if access token linked is expired? I am using Implicit grant flow 如何从 AWS Cognito 上的托管 UI 获取用户池令牌 - How to get the User pool token from Hosted UI on AWS Cognito AWS Cognito 托管 UI — 如何使用返回的 JWT 令牌? - AWS Cognito Hosted UI — How to use the returned JWT token? 如何在带有 AD SAML 2.0 的 aws cognito 中不使用托管 ui 的情况下获取 jwt 令牌 - how to get jwt token without using hosted ui in aws cognito with AD SAML 2.0 AWS 认知 | OAuth 2 使用授权授予方法 | 刷新令牌问题 - AWS Cognito | OAuth 2 using Authorization Grant method | Issue with refresh token 如何让 Amazon Cognito 托管的 UI 提示输入 TOTP? - How do I get the Amazon Cognito hosted UI to prompt for TOTP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM