Skip to content

Code flow in a popup #1382

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

Open
Christoph142 opened this issue Dec 22, 2023 · 3 comments
Open

Code flow in a popup #1382

Christoph142 opened this issue Dec 22, 2023 · 3 comments

Comments

@Christoph142
Copy link

First of all: Thanks so much for this library! So far we used the code flow by calling the initCodeFlow() method, which has been working fine for us in the last months.

However, we now tried adjusting our page (Angular SPA) to make it work with disabled cookies (and hence session storage) and therefore supplied a custom in-memory storage as a fallback when session storage access is impossible. By design, this forces us to stay on the page, because otherwise the nonce and pkce_verifier are lost and the returned code can't be checked anymore.
Hence we tried switching to initLoginFlowInPopup() instead of initCodeFlow() to stay on the page and getting the code via the popup in parallel.
For some reason, though, the opened popup (or tab if browser forces it to open as such) gets redirected to our SPA and the page shows in there (logged in if session storage is enabled) instead of closing the popup and passing the code back to the opener tab.

I noticed that there's no initCodeFlowInPopup method, but only initImplicitFlowInPopup, which makes me wonder, whether this scenario isn't supported at all or whether there's some kind of misconfiguration on our end either in the SPA config or our authentication server.

Could someone shed some light on this?

@Christoph142
Copy link
Author

(Lib version 17.0.1, Angular 16, Browser: Vivaldi 6.5 (Chromium 120))

@michaelfaith
Copy link
Contributor

michaelfaith commented Dec 27, 2023

Have you read this?

# Logging in With a Popup

According to the code the initLoginFlowInPopup works for both code flow and implicit. The implicit function is just for backwards compatibility. So, to answer your question, it should be supported.

* This method exists for backwards compatibility.
* {@link OAuthService#initLoginFlowInPopup} handles both code
* and implicit flows.

@Christoph142
Copy link
Author

Christoph142 commented Jan 8, 2024

Thanks for the answer @michaelfaith. It's a misconfiguration then? How can we debug this?
Maybe I also misinterpreted the info in silent-refresh.md linked in the popup.md you mentioned. It states that for the code flow, it's easier to go for the "Token Refresh" (the link points to https://github.com/manfredsteyer/angular-oauth2-oidc/blob/f1d3c38bdc77b37a21df2e63f8cbe40eadfc6152/docs-src/token-refresh.html instead of token-refresh.md). But the info in the popup.md linking there does not state that this method can be used. So which one is it? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants