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

查看:64
本文介绍了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令牌)声明.

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天全站免登陆