AWS Cognito:向 JWT 访问令牌添加自定义声明/属性 [英] AWS Cognito: Add custom claim/attribute to JWT access token

查看:41
本文介绍了AWS Cognito:向 JWT 访问令牌添加自定义声明/属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用为每个新注册用户创建了一个自定义属性userType".现在,我希望在用户登录或令牌刷新时将此userType"声明/属性添加到 JWT 访问令牌中.

My app creates a custom attribute "userType" for each new signed-up user. Now I would like this "userType" claim/attribute to be added to the JWT access token whenever the user signs in or the token gets refreshed.

是否可以选择告诉 Cognito 将我的自定义声明/属性添加到 JWT 访问令牌?(没有预令牌生成 Lambda)

Is there an option to tell cognito to add my custom claim/attribute to the JWT access token? (Without a pre token generation Lambda)

推荐答案

自定义属性在 Cognito 访问令牌中不可用.目前无法使用 预令牌生成 Lambda 触发器.PreToken Generation Lambda Trigger 仅允许您自定义身份令牌(Id Token)声明.

Custom attributes are not available in Cognito access token. Currently it is not possible to inject additional claims in Access Token using Pre Token Generation Lambda Trigger as well. PreToken Generation Lambda Trigger allows you to customize identity token(Id Token) claims only.

这篇关于AWS Cognito:向 JWT 访问令牌添加自定义声明/属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆