I created a user in Keycloak, its Username is myuser and its Email is myuser@xx.com.
I then successfully logged into Grafana with this user,but when I logged out from Grafana and then logged into Grafana with admin user again, I found a problem, navigate to Server Admin → Users sub-menu, I noticed that although Grafana created a new user, but it used the email address instead of the username as the login name, how can I get Grafana to use the username ‘myuser’ instead of the email address ‘myuser@xx.com’ as the login name?
The following is my Generic OAuth in grafana.ini
#################################### Generic OAuth ##########################
[auth.generic_oauth]
enabled = true
name = OAuth
allow_sign_up = true
client_id = grafana
client_secret = 553fb17e-a61d-486c-98c0-eb2db0a3eb4f
;scopes = user:email,read:org
scopes = profile
;email_attribute_name = email:primary
;email_attribute_path =
login_attribute_path = loginName
;id_token_attribute_name =
auth_url = http://192.168.1.10:8080/auth/realms/tenant/protocol/openid-connect/auth
token_url = http://192.168.1.10:8080/auth/realms/tenant/protocol/openid-connect/token
api_url = http://192.168.1.10:8080/auth/realms/tenant/protocol/openid-connect/userinfo
;allowed_domains =
;team_ids =
;allowed_organizations =
;role_attribute_path =
;tls_skip_verify_insecure = false
;tls_client_cert =
;tls_client_key =
;tls_client_ca =