简体   繁体   English

为Azure移动应用程序网站登录指定重定向URL

[英]Specifying redirect url for Azure Mobile App website login

When the App Service has "Action to take when request is not authenticated" set to "Log in with X", any webpage hit gets sent to X for user login. 当App Service将“请求未经过身份验证时采取的操作”设置为“使用X登录”时,任何网页命中都会发送到X以供用户登录。 Once the user logs in, the user is redirected to the page where they started. 用户登录后,用户将被重定向到他们启动的页面。

在此输入图像描述

For example, when the Social login service is Active Directory B2C, and the user starts from http://example.com/admin/monitor the user is sent to https://login.microsoftonline.com/...?...&state=redir%3D%252Fadmin%252Fmonitor 例如,当社交登录服务是Active Directory B2C,并且用户从http://example.com/admin/monitor启动时,用户将被发送到https://login.microsoftonline.com / ...?.. &状态=再导向%3D%252Fadmin%252Fmonitor

In this particular instance, I do not want all webpages to require authentication. 在这个特定的实例中,我不希望所有网页都要求身份验证。 How can I send a user to .auth/login/aad and specify the redirect_uri so that it comes back to the right page? 如何将用户发送到.auth / login / aad并指定redirect_uri以使其返回到正确的页面? If I do not specify anything, I end up at 如果我没有说明什么,我最终会

在此输入图像描述

and the website is only the originating website. 而该网站只是原创网站。

I am looking for something like https://example.com/.auth/login/aad?return_url=blahblah - I sure hope it exists! 我正在寻找像https://example.com/.auth/login/aad?return_url=blahblah这样的东西 - 我当然希望它存在!

Incidentally, there is a "redirect_uri" in aad that goes to /.auth/login/aad/callback. 顺便说一句,aad中有一个“redirect_uri”转到/.auth/login/aad/callback。 It looks like redirect_uri=https%3A%2F%2Fkamelos-app.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback. 它看起来像redirect_uri = https%3A%2F%2Fkamelos-app.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback。 This is different than what I am talking about. 这与我所说的不同。 After it goes to AAD, it goes to the Azure Mobile App and posts state=redir%3D%252Fadmin%252Fmonitor along with the token. 进入AAD之后,它会转到Azure移动应用程序并发送state = redir%3D%252Fadmin%252Fmonitor以及令牌。

Update. 更新。 I believe I am looking for "post_login_redirect_url" 我相信我在寻找“post_login_redirect_url”

You are looking for post_login_redirect_url I do not think there's a way to assign it from within a portal. 您正在寻找post_login_redirect_url我认为没有办法从门户网站中分配它。
What you have to do instead is to navigate your users to 您需要做的是将用户导航到

 /.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 您的应用程序可以通过将用户导航到您网站的/.auth/login/端点来触发相同的重定向,其中包括aad,facebook,google,microsoftaccount和twitter之一

from: https://azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/ 来自: https//azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/

If writing additional code is not an option you can configure an advanced authentication with AAD (not sure about Google, facebook, etc) 如果无法编写其他代码,您可以使用AAD 配置高级身份验证 (不确定Google,Facebook等)

And when you do that you can add post_login_redirect_url to a return url. 当你这样做时,你可以将post_login_redirect_url添加到返回网址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM