Thank you for the quick reply. Would it be possible to use the HTTP API to set the orgId and user’s role after it has been created ? We prefer not to use the UI to create users .
Sorry to bump this, but I came across this thread as we are also looking for ways to this. Namely, assign new users to a particular organization based on OAuth attributes.
@torkel, is this functionality something that’s on the horizon, or should we just find a work-around?
I understand that it’s not possibile assign user to particular OrgID by OAuth attributes.
But is it possible instead pre-create users (also with Grafana UI), ad assign them to a particular organization with OAuth login mode enabled?
I tried but seems that when a user login for first time after I created it inside Grafana, it is duplicated inside user list (no match on email or username).
Currently it is not possible to assign a user to an organisation through OAuth login.
see this PR:23661 for completely supporting of organisations <-> role mapping
The workaround is to manually create organisations and assign users to multiple organisation with roles (Admin, Editor, Viewer).
This will work only if you delete the property role_attribute_path from grafana.ini otherwise upon OAuth login, Grafana would remove the logged-in user from other organisations except the main org with id = 1.
@marcoboffi@gtaspider Been struggling with this same thing for weeks, any suggestions?
The only thing i’m currently leaning to is to allow basic auth and using the API to create users. But man i really don’t like that solution. If there just would be a way of assigning the org, or team or anything when a user logs in for the first time