简体   繁体   中英

Is there any login REST-API for user in keycloak?

Is there any login REST-API for created users in keycloak?

I used API

{{root}}/realms/{{realm}}/protocol/openid-connect/token

but it gives only access token but I need full information of the user

Thanks in advance

I think what you are looking for is user info API which provides information of currently logged in user:

Try this: (by passing the token obtained from url you mentioned: {{root}}/realms/{{realm}}/protocol/openid-connect/token )

GET "{root}/auth/realms/yourRealmName/protocol/openid-connect/userinfo"

A sample response from my setup:

{
    "sub": "d32be694-f438-44a5-95f2-7434ff37ca1e",
    "email_verified": false,
    "roles": [
        "Administrator"
    ],
    "groups": [
        "Administrator"
    ],
    "preferred_username": "administrator" 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM