-
Notifications
You must be signed in to change notification settings - Fork 133
Set access/refresh token manually #172
Comments
We are currently in the process of doing the exact same thing. We're almost there with a hacky workaround implementation that wraps the SSRCookie persistor and sets the So, +1 |
Glad we're not alone! I kind of got a working-ish solution also using this implementation (using Following this implementation I was able to create a simple setter
and then following this Unfortunately, only the first call to refresh/create the token worked. All others failed because for some reason, |
@StevenMarrocco I work with @Julian-Cloudshelf and this is the solution we have come up with so far, which is far from ideal. We are using the SSR package, and we had to do quite a few hacky things to get this "working". It should be noted that we have two domains for our project. One for the frontend, and one for the keycloak instance. When we access our application in a usual way, we can use the normal keycloak authentication, however we need to support logging in via an access key provided by our backend(using token exchange). We need to write out own persistor, and use it in the
The perisitor looks like this:
We then need to write a wrapper around the
Finally, we have an authstate which looks like this:
While this seems like it is going to work for us (we haven't finished the impmentation, but hardcoded access tokens we provided in the |
@ashleyww93 thank you for the detail and happy new year! This will come in handy. Looks like we're trying to accomplish the exact same thing. Really appreciate it I do like the use of the That said, I hope this ticket gets some eyes from some maintainers also as an official way would be awesome; edit: sorry follow up question; |
A feature like this would be useful for testing locally too. I.e. "ignore the config and just use this token". |
Is your feature request related to a problem? Please describe.
Currently, we've implement a "partial" authenticated flow, where (in specific scenarios) we have our backend provide us the access/refresh token that it receives from keycloak.
Describe the solution you'd like
Setting the token and have it be used in
initConfig
(ideally triggering a token refresh)Describe alternatives you've considered
After reviewing this issue would it be possible to set
this.tokens
afterkeycloak
has been initialized?The text was updated successfully, but these errors were encountered: