Fetching user by token?

Hello there,
I am trying to Secure a NuxtJS Frontend and a Quarkus backend with Keycloak.
I am getting a Token by the server but i coundn’t find any Rest endpoint that can give me a user object based on the auth token?

Kind regards,
Rosario

Some user details are already in the id/access token - try to decode token to see what is there. For example with https://jwt.io/#debugger-io . If you need more user details, then userinfo endpoint may provided more (but that depends on the client configuration).

tried exacly that but nuxt auth requires to fetch it from an api, thats why i am asking :frowning:

So check nuxt doc. Quick google search https://auth.nuxtjs.org/schemes/oauth2.html#userinfo-endpoint and you will have usage of already mentioned userinfo endpoint.

@jangaraj I am so sorry, i over red the userinfo-endpoint for the past 3 days!
tried to implement the way it should work now but getting another error on the keycloak side now

getting the token correctly but getting "error_description=Client+is+not+allowed+to+initiate+browser+login+with+given+response_type.+Implicit+flow+is+disabled+for+the+client
" when beeing redirected.

maybe you can tell me if its something with keycloak or something on the nuxt end :frowning:

There is a few OIDC flows and your app has decided to use implicit one. But it looks like Implicit checkbox is not enabled in the Keycloak client configuration:
image

BTW: implicit flow is not recommended anymore. You should use authorization code flow with PKCE instead of implicit flow.

I have poor frontend (all js, spa) skills, but for nuxjs looks like another spa/npm project, so why you don’t use any suitable certified module (Certified Open ID Developer Tools - OpenID Foundation), e.g. GitHub - damienbod/angular-auth-oidc-client: npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow

Hey, thanks for your help! I’ll have a look into the sources you gave me but i think for this school project i’ll stick to the implicit flow to make things easyer now :stuck_out_tongue: Thank you <3

Getting “invalid redirect URI” now - maybe it’s because of my bad English but pls tell me if I misunderstood it
I want to get redirect to http:localhost:3000/test so I put it into the valid redirect URI field. Same for my Nuxt config?
08:20:51,791 WARN [org.keycloak.events] (default task-10) type=LOGIN_ERROR, realmId=testrealm, clientId=backendApp, userId=null, ipAddress=172.18.0.1, error=invalid_redirect_uri, redirect_uri=/test

Redirect URL is another Keycloak client configuration, which is apparently not configured properly. See doc: https://www.keycloak.org/docs/latest/server_admin/#oidc-clients

Just to save your further questions:

Hey, first: thanks for your answer but the doc did not help me. Like i said, i set the valid redirect uri to my apps /test page. The docs do not help me with debugging my problem at this point because i have set a (in my optinion) valid uri…

@jangaraj