【发布时间】:2018-11-29 12:15:39
【问题描述】:
在MongoDB Custom Authentication 之后,任何具有以下最小字段的JWT Token 都适用于 MongoDB Stitch 身份验证。另外,token需要External Authentication System发行
{
"aud": "<stitch app id>"
"sub": "<unique user id>",
"exp": <NumericDate>,
}
我已经测试过了,它也可以正常工作
- 创建了 Stitch 应用程序并使用
Custom Authentication Provider启用了用户 - 通过Jwt.io 使用以下输入生成样本令牌。 (启用自定义身份验证提供程序时使用与配置相同的算法和密钥,这里是 HS256 和 )
它的工作方式,
- 它使用
sub:"sub": "<unique user id>"中提供的唯一value验证 MongoDB Stich 用户集合中的用户,如果用户存在,则返回该用户的对象 ID。 - 如果用户不存在,那么它将根据输入创建一个并返回对象 ID。
查询是,
- 为什么它会创建一个新用户而不是返回登录失败,这反过来又像任何用户都可以按需使用任何凭据登录一样工作?
- 如果
MongoDB Stitch Custom Authentication涉及External Authentication System下发JWT,用户注册时用户数据实际存放在哪里? -MongoDB Stitch App Collection或External Authentication API System?
【问题讨论】:
标签: mongodb jwt custom-authentication mongodb-stitch