What Grafana version and what operating system are you using?
Grafana version: 8.4.5
OS: Ubuntu 20.04
What are you trying to achieve?
Successful login through Azure AD B2C
How are you trying to achieve it?
By following instructions laid out by both applications
What happened?
after clicking the button to sign in using azure I am taken to the appropriate login page. after the proper credentials are given I am redirected back to the /login/generic_oauth endpoint and see the following page:
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
yes, I see the following vague error in the logs:
Did you follow any online instructions? If so, what is the URL? SSO using Azure AD B2C
The suggestions there do not seem to work for me. any help would be greatly appreciated
You didn’t increase log level so you see only info+ logs. Enjoy debug log level. I guess token endpoint response returns error message where you will see what is wrong.
BTW: api_url is wrong - there should be userinfo endpoint, not a discovery endpoint - but that shouldn’t be a root cause of your current problem.
DBUG[04-22|14:08:12] Getting user info logger=oauth.generic_oauth
DBUG[04-22|14:08:12] Extracting user info from OAuth token logger=oauth.generic_oauth
DBUG[04-22|14:08:12] Received id_token logger=oauth.generic_oauth raw_json="{<redacted>}" data="<redacted>"
DBUG[04-22|14:08:12] Getting user info from API logger=oauth.generic_oauth
DBUG[04-22|14:08:12] Error getting user info from API logger=oauth.generic_oauth url= error="Get \"\": unsupported protocol scheme \"\""
DBUG[04-22|14:08:12] Processing external user info logger=oauth.generic_oauth source=token data="Name: <redacted>, Displayname: , Login: , Username: , Email: , Upn: , Attributes: map[]"
DBUG[04-22|14:08:12] Setting user info name from name field logger=oauth.generic_oauth
EROR[04-22|14:08:12] Error getting email address logger=oauth.generic_oauth url=/emails error="Get \"/emails\": unsupported protocol scheme \"\""
EROR[04-22|14:08:12] login.OAuthLogin(get info from generic_oauth) logger=context error="Error getting email address: Get \"/emails\": unsupported protocol scheme \"\""
EROR[04-22|14:08:12] Request Completed logger=context method=GET path=/login/generic_oauth status=500 remote_addr=[::1] time_ms=1025 size=1372 referer=
BTW: api_url is wrong - there should be userinfo endpoint, not a discovery endpoint - but that shouldn’t be a root cause of your current problem.
Customize your config based on OAuth authentication | Grafana Labs . Grafana must find user email in the id_token. You redacted your id_token payload, so only you know where is email stored and you need to know what to configure properly (email_attribute_path/email_attribute_name).
Yes, again contact your Azure support and ask why you don’t see email in the id_token (maybe only used client need some minor config).
You may try to use https://graph.microsoft.com/oidc/userinfo as api_url (very hackish and advanced solution). It is not OIDC userinfo endpoint, but it is Graph API endpoint, which provides also JSON output. It works for non B2C Azure and it may work (not guaranteed) also for B2C Azure.
GOT IT! It works now. I had manually add email as a user attribute in the application claims section on the azure side. Thank you so much for your help jangaraj. I don’t think I could have solved this without you talking me through it