You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get a simple example up and running. It's built on Vue.js but I think that doesn't matter here. My aim is to login (successful) and run a fetch on an API, a fetch that uses the access_token which is hold in the ServiceWorker only. To reproduce it please see quote my code below.
My interpretation:
After a successful login the oidc-client gets the token from Keycloak and handles it the correct way:
"Token { "accessToken": "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default_default", "expiresIn": 300, "idToken": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJ3ZHFMZC1tS01aRVpMcGY5SFQxclRDUjhEQmFma2..."
My attempt to run the fetch on the API does not work as I do not use the oidc-client the way it must be, means, to use the ServiceWorker as proxy. I.e. the token displayed in the browser shows totally correct that it does not want to show the access_token but the same time the fetch via oidc-client does not proxy & add the Bearer-token
Expected
Successful API-Response.
Actual
ServerError 500 because of this access_token being sent by oidc-client:
"ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default_default"
In the template-section there are @click-Elements calling the functions "login", "logout" and "fetchProjects". The latter one results in an server-error because the oidc-client passes the string "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default_default" as bearer-token.
It would be very cool if anybody could enlighten me of how to use the oidc-client. I did not find examples in neither the react nor the "vanilla" example that showed me how to use it. And documentation in the code is a bit rare ;-)
Thank you!
The text was updated successfully, but these errors were encountered:
Hello @guillaume-chervet
I provided an OidcTrustedDomains.js but it looks like the structure of OidcTrustedDomains.js in the react-demo was not okay for being used here. After I used the sample from your "Getting started" it works.
So this code for OidcTrustedDomains.js completes my example above:
Issue and Steps to Reproduce
I'm trying to get a simple example up and running. It's built on Vue.js but I think that doesn't matter here. My aim is to login (successful) and run a fetch on an API, a fetch that uses the access_token which is hold in the ServiceWorker only. To reproduce it please see quote my code below.
My interpretation:
After a successful login the oidc-client gets the token from Keycloak and handles it the correct way:
"Token { "accessToken": "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default_default", "expiresIn": 300, "idToken": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJ3ZHFMZC1tS01aRVpMcGY5SFQxclRDUjhEQmFma2..."
My attempt to run the fetch on the API does not work as I do not use the oidc-client the way it must be, means, to use the ServiceWorker as proxy. I.e. the token displayed in the browser shows totally correct that it does not want to show the access_token but the same time the fetch via oidc-client does not proxy & add the Bearer-token
Expected
Successful API-Response.
Actual
ServerError 500 because of this access_token being sent by oidc-client:
"ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default_default"
Script-Section
In the template-section there are @click-Elements calling the functions "login", "logout" and "fetchProjects". The latter one results in an server-error because the oidc-client passes the string "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default_default" as bearer-token.
It would be very cool if anybody could enlighten me of how to use the oidc-client. I did not find examples in neither the react nor the "vanilla" example that showed me how to use it. And documentation in the code is a bit rare ;-)
Thank you!
The text was updated successfully, but these errors were encountered: