Open Spinnenzunge opened 9 months ago
Changed title and description as my initial issue was a bit confusing.
same problem here
When you call the methods again, do they emit the correct value?
When you call the methods again, do they emit the correct value?
Yes, but you have to "re-subscribe" in order to get the correct value, it doesnt stream the "new" value. I use it in the ngOnInit of the app.component in order to show / not show user's initials in the upper right corner. If I reload the app (F5), isAuthenticated emit the correct value.
Subscribing to isAuthenticated() means to me:
Did I misunderstand the use of isAuthenticated()?
I'm using:
The intention of the method was: You call it, you get the value when you want it, once. We also have the other stream which should emit the value like a stream. So you can choose on your end what you want.
Please read the next post.
Thank you for your support.
The problem with isAuthenticated$ comes up when you change route (it doesnt matter if it's protected or not by a AutoLoginPartialRoutesGuard) or you refresh the page, because the next value emitted is again false, even if I'm still authenticated (I can surf protected routes).
So in my case:
I'm using a single config.
I dont know exactly how, but I solved my problem...now I have to investigate why it works now.
Again thank you for your support.
The intention of the method was: You call it, you get the value when you want it, once. We also have the other stream which should emit the value like a stream. So you can choose on your end what you want.
The Problem is that the other streams only exists for isAuthenticated$
and userData$
not for e.g. resolved id token payload. So if we do want to have an observable that acts like a real stream for subscription we would need to create our own one by switchMapping getPayloadFromIdToken()
on e.g. isAuthenticated$
or something like that. This is of course possible but would appreciate it if the lib public api would work like that out of the gate, especially if it is already typed as an observable
We can implement that. However, currently I do not even have time to breathe. We are accepting PRs and when I find time, I will have a look into it :)
Version
16.0.1
Please provide a link to a minimal reproduction of the bug
https://github.com/damienbod/angular-auth-oidc-client/tree/main/projects/sample-code-flow-standalone
Please provide the exception or error you saw
Steps to reproduce the behavior
A clear and concise description of what you expected to happen.
Additional context
No response