Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Backend? Microsoft Graph #4

Closed
NBajanca opened this issue Dec 22, 2016 · 4 comments
Closed

New Backend? Microsoft Graph #4

NBajanca opened this issue Dec 22, 2016 · 4 comments

Comments

@NBajanca
Copy link

Microsoft Graph documentation says that AzureAD endpoints are used, and so it would make sense to use AzureAD Oauth2 backend.

My biggest doubt is in SOCIAL_AUTH_AZUREAD_OAUTH2_RESOURCE where I though the correct value would be https://graph.microsoft.com/v1.0/me
Unfortunately, I always get this error:

The application named https://graph.microsoft.com/v1.0/me was not found in the tenant named ****.

I think this is related to the fact that graph is not considered a resource by Azure AD but the documentation is a little scarce.

For my needs, I configured a new backend:

    def user_data(self, access_token, *args, **kwargs):
        """Grab user profile information from microsoft."""
        response = self.get_json('https://graph.microsoft.com/v1.0/me',
                             headers={'Authorization': 'Bearer ' + access_token})
        return response   

I would like assistance to understand if I should fork my developments or if I'm doing something wrong about AzureAD backend.

@NBajanca
Copy link
Author

After a better understanding it is possible to use the SOCIAL_AUTH_AZUREAD with Microsoft Graph by doing:

SOCIAL_AUTH_AZUREAD_OAUTH2_RESOURCE = 'https://graph.microsoft.com/'

@omab
Copy link
Contributor

omab commented Dec 31, 2016

@NBajanca I've added it to the AzureAD backend docs python-social-auth/social-docs@499fbaa.

@NBajanca
Copy link
Author

Thank you for this and for this great library @omab. Happy new year!

@jpatel3
Copy link
Contributor

jpatel3 commented Jan 4, 2018

I think it needs to be updated. I am getting following error when AzureADOAuth2 backend -

Sorry, but we’re having trouble signing you in.
We received a bad request.

Additional technical information:
Correlation ID: e6592900-fab7-4d10-8920-cdd63ec483ff
Timestamp: 2018-01-04 19:59:18Z
AADSTS50020: We are unable to issue tokens from this API version for a Microsoft account. Please contact the application vendor as they need to use version 2.0 of the protocol to support this.

If I understand correctly, instead of using 1.0 API, it's asking for 2.0 as when we specify grpah.microsoft.com, it might be pointing to the latest one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants