leo*_*o c 8 amazon-web-services amazon-cognito aws-cognito
我正在为我的Web App尝试Cognito用户池的登录功能.我能够获得令牌,但我不知道在哪里可以找到解密它的秘密.我在其中一篇文章中读到,秘密是用户池中应用程序的秘密ID.但是,对于Javascript SDK,密码ID为空.这是否意味着我的秘密也应该是空白的?我试过这个但是我收到一条消息"错误:PEM_read_bio_PUBKEY失败".
B M*_*B M 13
要纠正其他答案:RS256是一种非对称算法,需要公钥和私钥.另见RS256与HS256:有什么区别?和https://en.wikipedia.org/wiki/RSA_(cryptosystem).
正确的是,为了验证JWT,您不需要用于签名的私钥,只有AWS提供的公钥https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-known/jwks.json
.
AWS使用RS256算法,不需要秘密,而是需要公钥来解码。
在这里您将找到池的 JWKS:(https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-known/jwks.json
请参阅http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html#amazon -cognito-identity-user-pools-using-id-and-access-tokens-in-web-api)
这里描述了将 JWK 转换为公钥的过程:https://mobile.awsblog.com/post/Tx3JK25U7Z9EUIU/Integrating-Amazon-Cognito-User-Pools-with-API-Gateway(在“理解代码”部分下) )。
归档时间: |
|
查看次数: |
7678 次 |
最近记录: |