-
Notifications
You must be signed in to change notification settings - Fork 695
Events and onTokenReceived seemingly not working. #133
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
Comments
It seems that callback and events are fired only for oidc. This library is supposed to support oauth2 without oidc no? What am I missing? |
@otinanism I looked at the code for where the events are fired and yea, it seems the function stops and returns before doing any of the callback/event logic when using oauth2 only (non-oidc). I would consider trying to fix it myself, but this seems like a larger design question that @manfredsteyer should probably chime in on. Is this intended? If not, it looks like the function in question would need a bit of a refactor to handle the branching logic. Would it be better to switch to a guaranteed promise/observable for the whole function, regardless of type, instead of using a callback? |
Thx for pointing this out. The lib is now also raising the token_received when we only get an access_token. This will published soon. |
Hi guys, sorry that i reopen this bug but this is still not working for me. I have
Am i missing something here? Does anyone know how can i deal with this? Thx! |
@federicojsequeira In my case, I subscribed to the "token_received" event using Angular's standard For an example, here is my app component using this. The nesting is getting a bit out of hand since I haven't gone back to clean it up (it was just a prototype), but it should be simple enough to understand what is going on. |
@defmonk0 thanks for your response. I already tried that and i don't see a way to get the redirect url that has been stored when |
I already found a way, im doing this:
If someone see a possible issue here pls let me know. Thxs! |
I tried using the below code but it does not redirect to the original url after login. this.oauthService.events.subscribe(({ type }: OAuthEvent) => { This is the code I have in appcomponent and I am using implicit flow. Can you please verify if I am using the token_received event correctly constructor(private oauthService: OAuthService, private router: Router) { |
Let's say that we haven't received the token. How to capture that scenario here ? |
Hello! Recently been trying this out for a new project, and have gotten it to work (for the most part).
After setting everything up, I properly get implicit flow working, and a token appears in local storage which I can use. Additionally, I tried subscribing to
OAuthService.events
and logging some information in theonTokenReceived
callback ofOAuthService.tryLogin
. Neither of these ever output anything to the console.My main app component is quite simple still currently, so I'm not sure why these logs don't work.
app.component.ts:
My main concern is that the SSO i'm using allows you to hit another URL to get some info about the token, at
/oauth/verify
. It's useful to get the user's name, id, etc. I didn't see a way to do this automatically in the documentation, so I was trying to do it inonTokenReceived
. That's when I came across this issue. (Side note: if I'm going about this wrong, and there IS a way to do this automatically that I missed, please let me know. Lol.)If you have any idea what's up, I'd love some help. If you need any additional info, let me know.
The text was updated successfully, but these errors were encountered: