如何在身份验证后将用户重定向到唯一回调 url?
How to redirect users to unique callback url after authentication?
我正在使用 Lock 和 Django 来验证我的用户,无论何时完成我都想将他们重定向到他们原来的同一页面,问题是我的 url 有唯一的 UUID,我可以不要在 Allowed Callback URLs 下列出所有这些,我最初有两种方法可以这样做:
在锁定 redirectUrl
参数中指定回调 urls - 问题:回调 URL 不匹配。 (不能指定每个新的唯一 url 到 Allowed Callback URLs)
指定我的唯一 urls 以锁定,然后 POST 它然后从 auth0 接收它以及用户信息,因此我可以使用它来重定向用户。 - 问题: 我认为不存在这样的功能。 (编辑:确实如此,请参阅答案。)
有什么办法可以实现吗?
经过更多研究解决方案 2 成为可能后,Auth0 允许我们通过可从回调中检索的 state
参数发送自定义编码数据。
For the most basic cases the state
parameter should be a nonce as
shown in the example below. But this field can also be a Base64
encoded json object that can hold multiple values such as a return URL.
可以在 link 上找到更多信息:https://auth0.com/docs/protocols/oauth2/oauth-state
我正在使用 Lock 和 Django 来验证我的用户,无论何时完成我都想将他们重定向到他们原来的同一页面,问题是我的 url 有唯一的 UUID,我可以不要在 Allowed Callback URLs 下列出所有这些,我最初有两种方法可以这样做:
在锁定
redirectUrl
参数中指定回调 urls - 问题:回调 URL 不匹配。 (不能指定每个新的唯一 url 到 Allowed Callback URLs)指定我的唯一 urls 以锁定,然后 POST 它然后从 auth0 接收它以及用户信息,因此我可以使用它来重定向用户。 - 问题: 我认为不存在这样的功能。 (编辑:确实如此,请参阅答案。)
有什么办法可以实现吗?
经过更多研究解决方案 2 成为可能后,Auth0 允许我们通过可从回调中检索的 state
参数发送自定义编码数据。
For the most basic cases the
state
parameter should be a nonce as shown in the example below. But this field can also be a Base64 encoded json object that can hold multiple values such as a return URL.
可以在 link 上找到更多信息:https://auth0.com/docs/protocols/oauth2/oauth-state