locked
Owin Authentication Pop-out RRS feed

  • Question

  • User390177474 posted

    Hello! Is it possible to initiate

    HttpContext.Current.GetOwinContext().Authentication.Challenge(

    Owin challenge in a pop out window? And when the user has authenticated, close the pop out window and redirect the original website?

    Monday, June 29, 2020 8:34 AM

Answers

  • User1535942433 posted

    Hi william12512512,

    As far as I think,there are no way to popup dialog in the challenge.I suggest you could window.open a new window.

    Just like this:

    1.Set refreshPage function

    2.In one page,use window.open a popup window to login page

    3.In the login page,call challenge method and  jump to microsoft login page

    4.In the login page, complete auth and then redirect url to a page which will be automatically closed.

    5.Finally,refresh the orginal page.

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 3, 2020 9:20 AM

All replies

  • User1535942433 posted

    Hi william125125125,

    As far as I think,you could bind a jquery click handler to the login button.When the user clicks on the button, the application will open the href of the button in a popup dialog.

    Then you could rewrite a new challenge event to render a script which will close the popup dialog.And then it could redirect the original website.

    Best regards,

    Yijing Sun

    Tuesday, June 30, 2020 7:43 AM
  • User390177474 posted

    Hi william125125125,

    As far as I think,you could bind a jquery click handler to the login button.When the user clicks on the button, the application will open the href of the button in a popup dialog.

    Then you could rewrite a new challenge event to render a script which will close the popup dialog.And then it could redirect the original website.

    Best regards,

    Yijing Sun

    But the thing is, there is no href i can redirect to. It's all handled by owin, I can't input a specific link, just initiate a challenge.

    Tuesday, June 30, 2020 7:58 AM
  • User1535942433 posted

    Hi william12512512,

    As far as I think,there are no way to popup dialog in the challenge.I suggest you could window.open a new window.

    Just like this:

    1.Set refreshPage function

    2.In one page,use window.open a popup window to login page

    3.In the login page,call challenge method and  jump to microsoft login page

    4.In the login page, complete auth and then redirect url to a page which will be automatically closed.

    5.Finally,refresh the orginal page.

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 3, 2020 9:20 AM
  • User753101303 posted

    Hi,

    Unclear. You should be directed to the 3rd party site which should direct you back to your site once authentication is completed.

    If this is not what you are seeing you likely have either to configure in the external app registration or in authentication parameters the address you want to be directed back one authentication is processed.

    Edit: maybe you are missing something such as:

    // set the callback, for after OWIN finishes examining what comes back from Google
    AuthenticationProperties properties = new AuthenticationProperties { RedirectUri = "https://www.myapp.com/some/callback/uri" };
    // send the user to Google
    Context.GetOwinContext().Authentication.Challenge(properties, "Google");

    borrowed from https://stackoverflow.com/questions/33698266/authenticationproperties-redirecturi-is-not-passed-to-google-in-challenge to pass the redirect uri ???

    For now I suspect using a popup is an attempt to solve an unknown problem you have with the whole authentication process.

    Friday, July 3, 2020 11:59 AM