问题
I've set up my Django social auth according to the documentation. With the following:
GOOGLE_OAUTH_EXTRA_SCOPE = ['https://www.googleapis.com/auth/calendar']
GOOGLE_OAUTH2_CLIENT_ID = *client id here*
GOOGLE_OAUTH2_CLIENT_SECRET = *client secret here*
In the API console, I have set it to a web application with the Redirect URI as omab says:
http://localhost:8000/complete/google-oauth2/
In my template I have:
<a href="{% url socialauth_begin 'google' %}" class="google_login_button">Login with Google </a>
However, when I test the application the oAuth doesn't ask for "calendar permissions", just the default email ones.
What am I missing??
回答1:
After some searching, it was a silly mistake. The link should be:
{% url socialauth_begin 'google-oauth2' %}
I misinterpreted the documentation when it said write in the name of whatever is in the backend.
Hope this helps future people.
回答2:
To save someone using the new python-social-auth and django > 1.4
Use this :
{% url 'social:begin' 'twitter' %}
来源:https://stackoverflow.com/questions/15735648/how-can-i-get-google-auth2-authentication-with-extra-scopes-to-work