[英]Authentication when combining Web and Mobile Apps in Azure
I follow this article: develop-mobile-apps-with-csharp-and-azure for combining my already fonctional Xamarin app with an small web site use by some admins.我关注这篇文章: develop-mobile-apps-with-csharp-and-azure ,用于将我已经具有功能的 Xamarin 应用程序与一些管理员使用的小型 web 站点结合起来。 In the article, we only need to add this in my web.config:文章中,我们只需要在我的web.config中添加这个:
<authentication mode="Forms">
<forms loginUrl="/.auth/login/aad" defaultUrl="/Home" timeout="480"/>
</authentication>
This addition work good, but after logging in and click on the ugly link "Return to you web site" provided by Azure, I always got redirect on the root of the site (that display: This mobile app is up and running).这个添加效果很好,但是在登录并点击 Azure 提供的丑陋链接“返回给你 web 站点”后,我总是在站点的根目录上重定向(显示:此移动应用程序已启动并运行)。 I try to add defaultUrl to redirect to the /Home page without success.我尝试添加 defaultUrl 以重定向到 /Home 页面但没有成功。 Any idea?任何想法?
You have probably not set the "Allowed External Redirect URLs".您可能没有设置“允许的外部重定向 URL”。 This feature allows you to call the authentication backend with a specific Redirect URL.此功能允许您使用特定的重定向 URL 调用身份验证后端。 On a successful authentication, it then redirects to one of the valid authentication redirects.在成功的身份验证后,它会重定向到有效的身份验证重定向之一。 You need to specify the url during the request by specifying a post_login_redirect_url
.您需要在请求期间通过指定 post_login_redirect_url 来指定post_login_redirect_url
。 For example:例如:
<forms loginUrl="/.auth/login/aad?post_login_redirect_url=/Home/Index" timeout="480"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.