Why not set up an Azure account and create an Azure AD tenant to find out? Tenants are free (you do not need any premium licenses to set up a tenant) and you can then play around all you want.
Socialite Microsoft Azure - Getting roles
Hello guys,
I know this is specific question but I am going out of resources which I tried. So the problem is following:
I am using oAuth from Azure with Socialite and custom driver for it from socialiteproviders/microsoft-azure package.
Everything regarding authentication works fine but I have additional request and that is to check which roles this Azure user has.
-
How can I obtain roles, I do not see any key in Azure user response which indicates roles.
-
I have found from some sources that roles are actually stored in the token itself. I have used following code to decode body of a token:
$body = explode('.', $azureUser->token)[1];
$decoded = JWT::jsonDecode(JWT::urlsafeB64Decode($body));
But there is no key roles there. I am using campus account which I am not sure has roles added to it (I am no expert in Azure AD, sorry) and I also do not have access to add them which makes my problem a bit more difficult. But I wanted to know if roles key would be always present even if there are no roles, meaning it would be empty array or is it only returned when there are some actual values?
Thank you in advance, any help is appreciated.
Please or to participate in this conversation.