xamarin - Azure AD token endpoint doesn't return an access_token (just an id_token and a refresh_token) -
i'm using xamarin.auth authenticating users against google , azure ad in xamarin forms based mobile app. while works expected google, i'm unable access_token azure ad:
- authorize works expected providing code , state
- token returns id_token , refresh_token, no access_token.
i can replay scenario in postman, doesn't seem caused xamarin.auth , more blamed inability interpret microsoft's documentation...
your appreciated!
you should include resource scope when acquiring token in azure ad v2.0. web-hosted resource integrates azure ad has resource identifier, or application id uri. example, microsoft graph https://graph.microsoft.com
.
if want acquire access token microsoft graph , , have permission read mails of sign-in user , token request :
post /{tenant}/oauth2/v2.0/token http/1.1 host: https://login.microsoftonline.com content-type: application/x-www-form-urlencoded client_id=6731de76-14a6-49ae-97bc-6eba6914391e &scope=https%3a%2f%2fgraph.microsoft.com%2fmail.read &code=oaaabaaaail9kn2z27uubvwfpbm0glwqjvzcte9ukp3psx1axxujq3n8b2jrlk4oxvxr... &redirect_uri=http%3a%2f%2flocalhost%2fmyapp%2f &grant_type=authorization_code &client_secret=jqqx2pno9bpm0ueihupzyrh // note: required web apps
please read this document how oauth 2.0 authorization code flow works in azure ad v2.0 .and click here scopes, permissions, , consent in azure active directory v2.0 endpoint
wiki
Comments
Post a Comment