[Question/Support] when a user opens a new tab in the web browser, it will redirect the user back to home page
See original GitHub issueHi guys,
Background:
I am using openid connect and implicit flow with silent refresh.
When a user opens a link (e.g. http://localhost/books) in a new tab in the web browser, firstly the angular app will do the authentication, and then it will redirect the user back to home page (e.g. http://localhost configured in the auth.config.ts show in below)
Question In this case, if users want to open a new tab to visit http://localhost/books , how should I redirect the user back to http://localhost/books rather than the homepage after re-authenticated? Any suggestions?
thanks Yanbo
auth.config.ts
export const authConfig: AuthConfig = {
// Url of the Identity Provider
issuer: 'http://localhost:9193',
// URL of the SPA to redirect the user to after login
redirectUri: window.location.origin,
// URL of the SPA to redirect the user after silent refresh
silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',
// The SPA's id. The SPA is registerd with this id at the auth-server
clientId: 'ng-client',
// set the scope for the permissions the client should request
// The first three are defined by OIDC. The 4th is a usecase-specific one
scope: 'openid profile web-api',
showDebugInformation: true,
sessionChecksEnabled: true
}
private configureWithFcWebApi() {
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.loadDiscoveryDocumentAndLogin();
this.oauthService.setupAutomaticSilentRefresh();
. . .
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
New Tab go to home page - Microsoft Community Hub
There should be an option for when opening a new tab it just goes to your home page instead of whatever that built...
Read more >How to open page in new tab using the response. redirect at ...
1 · 1 · @RickRunowski the target=_blank is used in hyperlinks in HTML, and it works the same when called from an ASP.NET...
Read more >Use tabs in Chrome - Computer - Google Support
On your computer, open Chrome Chrome . · Click New tab New tab . · Right-click a tab and then select Add to...
Read more >Use tabs for webpages in Safari on Mac - Apple Support
Open a new tab. In the Safari app on your Mac, click the New Tab button in the toolbar (or use the Touch...
Read more >Opening Links in New Browser Windows and Tabs
Users will have to switch to the new window or tab to complete their task and there's no guarantee that they will return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@yukund If you “get an infinite authorize loop” I suggest creating a minimal repro and posting a question on Stack Overflow, which is a lot better suited for such reproducible problems.
As for the example on how to combine loading disco document, implicit flow, and trylogin, you could have a sneak peek at my (work in progress!) example repo where I do something like this:
This will in order:
You could add an ìnitImplicitFlow()` at the complete end too if there’s still no valid token, up to your situation.
PS. IMHO the security difference between
sessionStorage
andlocalStorage
is negligable if you only store short-lived access tokens, but with my above suggestions it shouldn’t matter much (except a small delay for users) anyways.Again, if you have further issues, I suggest asking questions on Stack Overflow, which is much better suited for Q&A than GitHub Issues.
Aloha! I’m investigating something very similar.
First up, there’s two things troubling you (I think):
If you solve part 2 then you’d still have your question for new windows, so I suggest possibly solving them both.
For (1), using the “state” in the implicit flow to “remember” the route checkout the “Remembering State” docs, I believe that should fix things.
For (2) you could use
localStorage
instead ofsessionStorage
, but do check out #321 where I laid out both my issue with that and a workaround at the bottom.Hope that helps.