Grafana Oauth Login Problem

When I log in using the system’s oauth, grafana will create the corresponding account, but the login value of the account is set to email, how to set Login is a field value corresponding to userInfo?


some log

t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Getting user info from API” logger=oauth.generic_oauth
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“HTTP GET http://y-api.dtyunxi.cn/iam/v1/users/self: 200 OK {"objectVersionNumber":6,"id":429,"loginName":"sc-02","email":"sc-02@example.com","organizationId":1,"originalPassword":null,"realName":"sc-02","internationalTelCode":"","phone":null,"imageUrl":null,"profilePhoto":null,"enabled":true,"ldap":false,"language":"zh_CN","timeZone":"CTT","lastPasswordUpdatedAt":"2021-02-27 05:12:55","lastLoginAt":"2021-04-13 09:55:57","organizationName":"test","organizationCode":"operation","uuid":null,"locked":false,"lockedUntilAt":null,"passwordAttempt":0,"admin":false,"sourceId":null,"ddUserId":null,"ddUserName":null,"ddUnionId":null,"defaultPageParam":null,"defaultPageParamDTO":null,"roles":null,"passwordSyncFlag":null,"departmentId":null,"position":null,"departmentName":null,"healStatus":1}”
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Received user info response from API” logger=oauth.generic_oauth raw_json=“{"objectVersionNumber":6,"id":429,"loginName":"sc-02","email":"sc-02@example.com","organizationId":1,"originalPassword":null,"realName":"sc-02","internationalTelCode":"","phone":null,"imageUrl":null,"profilePhoto":null,"enabled":true,"ldap":false,"language":"zh_CN","timeZone":"CTT","lastPasswordUpdatedAt":"2021-02-27 05:12:55","lastLoginAt":"2021-04-13 09:55:57","organizationName":"test","organizationCode":"operation","uuid":null,"locked":false,"lockedUntilAt":null,"passwordAttempt":0,"admin":false,"sourceId":null,"ddUserId":null,"ddUserName":null,"ddUnionId":null,"defaultPageParam":null,"defaultPageParamDTO":null,"roles":null,"passwordSyncFlag":null,"departmentId":null,"position":null,"departmentName":null,"healStatus":1}” data=“Name: , Displayname: , Login: , Username: , Email: sc-02@example.com, Upn: , Attributes: map
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Processing external user info” logger=oauth.generic_oauth source=API data=“Name: , Displayname: , Login: , Username: , Email: sc-02@example.com, Upn: , Attributes: map
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Unable to find user info name” logger=oauth.generic_oauth
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Searching for login among JSON” logger=oauth.generic_oauth loginAttributePath=user.loginName
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Set user info email from extracted email” logger=oauth.generic_oauth email=sc-02@example.com
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“Defaulting to using email for user info login” logger=oauth.generic_oauth email=sc-02@example.com
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“User info result” logger=oauth.generic_oauth result=“&{Id: Name: Email:sc-02@example.com Login:sc-02@example.com Company: Role: Groups:}”
t=2021-04-13T09:57:21+0800 lvl=dbug msg=“OAuthLogin got user info” logger=oauth userInfo=“&{Id: Name: Email:sc-02@example.com Login:sc-02@example.com Company: Role: Groups:}”

I had the same problem, can you share the solution if you solve this problem?

This topic was automatically closed after 365 days. New replies are no longer allowed.