4. Learners point
As you all may be techies, but some people on blurt are not. So, try to share blogs you read, any books which the other people can do read. Let's create digital literacy and extend programming literacy. A person may not be able to code, but he can be able to read the code.
I was working with integrating Keycloak with an Ionic application, https://github.com/damienbod/angular-auth-oidc-client
All was working fine, but after being authenticated with keycloak i have to register that user back to the backend, so what i did i added a page callback and call
checkAuth
there to register user to backend and also there was a previous call to the same funcion in main app component, and whenever i was trying to test the flow i was getting 400 Bad Request,code is not valid
, from keycloak.Reaching to Google is the only way i could think of, but there was no solution which was solving the problem, i am putting some of the solution i found on Google
When i was looking at keycloak server log i could only find is the code is being used by so and so client already. But i was thinking i am running only one client where this is coming from it didn't struck to my mind about that app_component is also calling same function.
https://stackoverflow.com/a/67446927 but when i was reading this comment, then it strike to my mind removing that from callback and only keeping in app component and use
isAuthenticated
function in call back will do the stuff for me.And Voila!😌 it works
Learning
checkAuth
should be used only once in whole application https://github.com/damienbod/angular-auth-oidc-client with respect to this package if you need token in some other module or guard you can callthis.oidcSecurityService.getAccessToken()
Thats a nice progress and update. Thanks for sharing