Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loginPoup does not honor redirectUri in the original tab, popup window shows redirectUri! #559

Closed
4 tasks
aappddeevv opened this issue Feb 11, 2019 · 4 comments
Assignees
Labels
more-information-needed Use this label when you are waiting on information from the issue creator

Comments

@aappddeevv
Copy link

aappddeevv commented Feb 11, 2019

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Browser:

  • [X ] Chrome version: 72
  • Firefox version XX
  • IE version XX
  • Edge version XX
  • Safari version XX

Library version

Library version: 0.2.4

Current behavior

I thought this might be related to #238, #190, #174 .

I'm running a react, SPA with a history router, etc. localStorage option.

When I login using popup, the popup login works fine. However, after logging in through the popup, the redirect from the redirectUri (specified in the AAD portal and in the options so they match and are allowed) is only used within the popup window, so suddenly the popup window now has my application running in it and the redirectUri is honored in the popup window but no the original tab. The popup window does not close automatically.

If I make set the redirectUri to match the launch tab's URI or do not set the redirectUri the popup window closes properly but there is no redirect, I am just returned my original SPA with no redirect.

When I set redirectUri to a URI that is not the popup launch URI and nagivateToLoginRequestUrl = false or true, I see the same behavior, the popup now shows the app at the redirectUri.

In fact, it seems that when I set redirectUri to a URI that is not the launch tab's URI, the popup never closes properly and the redirectUri is honored in the popup window itself. navigateToLoginRequestUrl does not seem to make a difference.

#190 says to have the UserAgentApplication instance in the target "URI". Since its a SPA and the SPA has the app instance used to launch the popup, its already there. Since no redirect occurs, I don't even have a chance to use the approach described in #174.

Right now, once I return successfully to the original URI (either don't specify the redirectUri or make it match), I initiate the redirect myself. This makes the redirectUri parameter ineffective.

Expected behavior

I would expect that the popup window closes once logged in and that the browser tab from which the popup was launched and the redirectUri is honored in original tab window.

Minimal reproduction of the problem with instructions

Write an app that sets the redirectUri as described above.

@navyasric navyasric added the more-information-needed Use this label when you are waiting on information from the issue creator label Feb 13, 2019
@pkanher617
Copy link
Contributor

@aappddeevv Can you please add a snippet of how you are calling the loginPopup method and handling the response?

@aappddeevv
Copy link
Author

aappddeevv commented Feb 14, 2019

const app = new UserAgentAppliction(cid, auth, null, {
  cacheLocation: "localStorage",
  postLogoutRedirectUri = "https://localhost:8080/login
})
...
// login button
// I followed the example in the sample
app.loginPopup(scopes).then(..
   // then acquire token silent
      // if certain errors present in string, app.acquireTokenPopup

This is called from the url: https://localhost:8080/login here I have a login button. The

When the promise completes successfully in the "then" after getting the access token, I have a redirect that pushes https://localhost:8080 to take me to the home page, https://localhost. I had to add the redirect because the redirectUri when it was set to the home page, loaded the app in the browser popup. I had to set the redirect to /login or not specify it to make it work.

I've tried setting those other parameters with the effects as stated above.

@aappddeevv
Copy link
Author

aappddeevv commented Feb 14, 2019

Is this related to #245?

I see that navigateToLoginRequestUrl is marked as only relevant when using redirects.

@aappddeevv
Copy link
Author

Alright, I'm not sure I'm having this problem anymore. I think there was some bad state on my part but now I'm not seeing this behavior. Let's close it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
more-information-needed Use this label when you are waiting on information from the issue creator
Projects
None yet
Development

No branches or pull requests

3 participants