locked
Web app with AzureAD authentication RRS feed

  • Question

  • User-344678856 posted

    The issue I am experiencing, when the user hits my first page the request can come with a query string such as 

    https://myproject.com/?id=111111

    if the user is authenticated on Office365, that works absolutely fine, but if the user is not authenticated, I have a link for him to authenticate 

    <a asp-area="AzureAD" asp-controller="Account" asp-action="SignIn">here</a>

    When the user clicks the button, is redirected to Office365 for authentication, but after the authentication, he is redirected to the initial page of the app without any queries, like https://myproject.com/ 

    Any way of getting around this?

    Thursday, February 20, 2020 6:06 PM

All replies

  • User283571144 posted

    Hi AndrewPearTree,

    According to your description, if you want to enable the AzureAD authentication into your project, you should use the oauth oprnid connect to acheive this reuqirement. 

    You should firstly install the oauth into your web application and then register the web application into azure AD console.

    More details, you could refer to beow article.

    https://docs.microsoft.com/en-us/azure/active-directory/azuread-dev/ 

    Besst Regards,

    Brando

    Friday, February 21, 2020 2:24 AM
  • User-344678856 posted

    Thanks for your reply.

    I am already able to use AzureAD authentication, but the issue I am finding is if the user reaches my page with query strings but not authenticated, when the user clicks "Sign in" and log in with his credential, it redirects the user back to the app home page without the query string, and I can't find anywhere on the documentation how to return to the returnurl with queries. 

    Friday, February 21, 2020 9:16 AM
  • User1724605321 posted

    Hi AndrewPearTree ,

    Azure AD endpoint only accept standard openid connect parameter and it would return the standard parameters :

    https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

    So you can keep the custom query string in state parameter  .You can use this parameter to send arbitrary data as part of your request and it gets returned back to you in response:

    https://stackoverflow.com/a/44380787/5751404

    Best Regards,

    Nan Yu

    Thursday, February 27, 2020 9:55 AM