AWS Cognito:向JWT访问令牌添加自定义声明/属性

编程入门 行业动态 更新时间:2024-10-28 06:31:05
本文介绍了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访问令牌添加自定义声明/属性

本文发布于:2023-11-16 04:44:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1601099.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   自定义   属性   声明   AWS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!