当应用服务将“请求未经身份验证时采取的操作”设置为“使用 X 登录”时,任何网页点击都会发送到 X 以供用户登录。用户登录后,用户将被重定向到他们开始的页面。
例如,当社交登录服务为 Active Directory B2C,并且用户从 http://example.com/admin/monitor 开始时用户被发送至https://login.microsoftonline.com/...?...&state=redir%3D%252Fadmin%252Fmonitor
在这个特定实例中,我不希望所有网页都需要身份验证。如何将用户发送到 .auth/login/aad 并指定redirect_uri,以便它返回到正确的页面?如果我不指定任何内容,我最终会在
并且该网站只是原始网站。
我正在寻找类似 https://example.com/.auth/login/aad?return_url=blahblah 的内容- 我当然希望它存在!
顺便说一下,aad 中有一个“redirect_uri”,它会转到/.auth/login/aad/callback。看起来像redirect_uri=https%3A%2F%2Fkamelos-app.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback。这与我所说的不同。转到 AAD 后,它会转到 Azure 移动应用程序并发布 state=redir%3D%252Fadmin%252Fmonitor 以及 token 。
更新。我相信我正在寻找“post_login_redirect_url”
最佳答案
您正在寻找 post_login_redirect_url
我认为没有办法从门户内分配它。
您需要做的是将用户导航到
/.auth/login/<provider>?post_login_redirect_url=YOUR_URL
Your application can trigger the same redirect itself by navigating the user to the /.auth/login/ endpoint of your site, where is one of aad, facebook, google, microsoftaccount, and twitter
来自:https://azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/
如果无法编写额外的代码,您可以 configure an advanced authentication使用 AAD(不确定 Google、Facebook 等)
当您这样做时,您可以将 post_login_redirect_url 添加到返回网址。
关于c# - 指定 Azure 移动应用网站登录的重定向 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42824135/