简体   繁体   English

keycloak 中的用户是否有任何登录 REST-API?

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

Is there any login REST-API for created users in keycloak? keycloak 中创建的用户是否有任何登录 REST-API?

I used API我用的是 API

{{root}}/realms/{{realm}}/protocol/openid-connect/token {{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:我认为您正在寻找的是用户信息 API ,它提供了当前登录用户的信息:

Try this: (by passing the token obtained from url you mentioned: {{root}}/realms/{{realm}}/protocol/openid-connect/token )试试这个:(通过传递您提到的从 url 获得的令牌: {{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" 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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