oauth2client.contrib.django_util.views module

oauth2client.contrib.django_util.views.oauth2_authorize(request)[source]

View to start the OAuth2 Authorization flow

This view starts the OAuth2 authorization flow. If scopes is passed in as a GET URL parameter, it will authorize those scopes, otherwise the default scopes specified in settings. The return_url can also be specified as a GET parameter, otherwise the referer header will be checked, and if that isn’t found it will return to the root path.
Parameters:request – The Django request object
Returns:A redirect to Google OAuth2 Authorization
oauth2client.contrib.django_util.views.oauth2_callback(request)[source]

View that handles the user’s return from OAuth2 provider.

This view verifies the CSRF state and OAuth authorization code, and on success stores the credentials obtained in the storage provider, and redirects to the return_url specified in the authorize view and stored in the session.

Parameters:request – Django request
Returns:A redirect response back to the return_url