Hi, I'm trying to make ActiveDirectory work on Pyt...
# support-questions
a
Hi, I'm trying to make ActiveDirectory work on Python (Django). I'm able to fetch access token if I pass a constant email. Now, I'm trying to get profile info and following is the url I'm using.
Copy code
async with AsyncClient() as client:
            response = await client.get(  # type:ignore
                url='https://graph.microsoft.com/v1.0/me' ,headers=headers,
            )
In response I'm getting a json but there's no email attribute. So am I using the right url and also is there any reference for ActiveDirectory in python?
r
Hey!
Have you added email scope?
a
Yes
r
You’re talking about the implementation of the get_user_profile_info function correct?
a
get_profile_info function yes
r
I think the input to that function also contains an id_token. Does it? I think that contains the user’s email
a
{'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/$entity', 'businessPhones': [], 'displayName': 'AntonyBush .', 'givenName': 'AntonyBush', 'jobTitle': None, 'mail': None, 'mobilePhone': None, 'officeLocation': None, 'preferredLanguage': 'en', 'surname': '.', 'userPrincipalName': '*******_gmail.com#EXT#@**********gmail.onmicrosoft.com', 'id': 'eaf5ea12-dfd4-487c-b2b6-3e58d025dc01'}
this is the response I get
r
Have you added the scope of openid?
a
yep
r
That’s odd
a
email is present in userPrincipalName
My email domain is gmail.com. could that be an issue?
r
I don’t think so
The scope it gives is email, openid
And the input to the get profile function is an id_token. Which contains the email
a
I've seen this... here JWKS (to get the payload) is used...is there anything similar in python
r
We haven’t implemented anything similar in python yet. Though we will be soon
a
Ok
For the time being I'm using userPrincipalName. It's working as of now
r
Okay