How to set Azure Authentication custom login return url?

前端 未结 2 998
孤城傲影
孤城傲影 2020-12-10 18:00

I followed this article https://azure.microsoft.com/en-us/blog/announcing-app-service-authentication-authorization/ to set up Azure authentication for my MVC app. First I tu

相关标签:
2条回答
  • 2020-12-10 18:44

    Thank you. This really helped. The below worked ok for me:

         return RedirectToAction(string.Format("login/{0}?post_login_redirect_url=/Home/LoginCallBack", provider), ".auth");
    

    provider can be one the strings: google, twitter, microsoftaccount,aad,facebook.

    Also each provider must be configured on your project at the Azure Portal.

    redirect url may be any uri on your project

    0 讨论(0)
  • 2020-12-10 18:45

    You can use the post_login_redirect_url query string parameter to do this.

    For example, if you want to automatically navigate the user to /welcome.html after logging in, you can set your login redirect to ~/.auth/login/aad?post_login_redirect_url=/welcome.html, and the user will be redirected to this page instead of the generic welcome page.

    0 讨论(0)
提交回复
热议问题