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

OAuth2 provider that requires basic authorization to get access token #70

Closed
gianlucagiorgolo opened this issue May 12, 2016 · 2 comments

Comments

@gianlucagiorgolo
Copy link

After trying to get django-all-access to work with the OAuth2 server of FIWARE lab, I found out that it was expecting an Authorization key in the header of the POST request that gets the access token (I was getting a 405 error). I managed to get it working by passing the following header to the request made in get_access_token in OAuth2Client:

headers = {'Authorization' : 'Basic ' + base64.b64encode(str(self.provider.consumer_key) + ':' + str(self.provider.consumer_secret))}
response = self.request('post', self.provider.access_token_url, data=args, headers=headers)

Not sure how it would be the best way to patch the code to make it more general (I have no idea if this may cause problems with other providers or if more kinds of authorizations should be included). I hope this helps.

@mlavin
Copy link
Owner

mlavin commented May 12, 2016

You can configure the callback view to use a custom client for this provider which overrides get_access_token. Nothing to patch in django-all-access. These are already available customization hooks.

@gianlucagiorgolo
Copy link
Author

Cool thanks!

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

No branches or pull requests

2 participants