-
Notifications
You must be signed in to change notification settings - Fork 689
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
Recommended way of oauth2 guarding entire application. #478
Comments
There's nothing wrong with the code you're showing (though I suggest migrating to a promise-based solution over the object with You could check my sample implementation; I use a variant of that in production without any of the issues you're experiencing. As for your direct question:
I suggest calling |
Wow. That seems like an aweful lot of work around... that if necessary, should be integrated as part of the library... I dont know if I am just running buggy old version or what... but in just changing that stuff up there to |
For the record, I was attempting this with angular 5 project using 3.1.4 (I think)... but doesn't really seem to matter. I've also noticed that when it does work.... theres a lot of time wrapped up in that initial discovery, and actually redirecting back. |
Yeah then the docs probably still at some points lean to the
It is, and it isn't. You might not need all the stuff from my sample setup, you can pick and choose. The repo was meant to document the most extensive case I could fit in one example. In a lot of cases, perhaps also yours, just doing Note that in either case, to prevent weird pages from showing up in your app (if only for a moment), you should hold back on loading your application until the Still, I agree that the library could benefit from a little more sugar, which I proposed in #359 |
I guess I just feel like I want to go implicit flow, and the examples in the repo and readmes dont seem to clearly provide examples of that. Much of my usage of this library (the more I fiddle with it) I occasionally get weird redirect loops, or places where its not even attempting to redirect to login UI at all. I'm confident its probably mis-configuration on my part... but if there are things we can change to make a developer like myself, less prone to shooting myself in the foot... all the better. |
Looking back at this thread, most questions got at least some answer, and apart from that it's about guidance for creating apps actually using the library? I'm tempted to close this issue, unless we could boil things down again to a specific question or feature request? |
Going to keep things tidy and close this issue for now. If the original question is still open, please let us know what the precise left over question is. If you have another (potentially related) issue: feel free to open a fresh issue with minimal repro! |
Greetings.
I've used this library in a number of angular applications before, but I must be doing something wrong, and am hoping I can get to the bottom of this stuff.
Basically I've got applications I'd like to initialize where it'll check for token in whatever storage, and redirect to login immediately.
Currently I've done things like this:
Very frequently I'll end up at a page that just doesn't login, end up with a white screen and console log that says 'attempting to login'. My Identity server reports no errors, but just never goes further than that.
So I guess my question is, if I decide to not have a explicit login/logout button that calls initImplicitFlow(), how do I best fire my app up in such a way that I redirect immediately if no VALID token has been stored?
I tried checking after that
loadDiscoveryDocAndTryLogin
for a token, and then calling initImplicitFlow(), which seems to help in some cases, and in other, it causes just constant redirects to identity server and then back.The text was updated successfully, but these errors were encountered: