def google_login(request):
    token_request_uri = 'https://accounts.google.com/o/oauth2/auth'
response_type = 'code'
client_id = XXXXXX - your_client_id
redirect_uri = 'http://mysite/login/google/auth'
scope = (
    """https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"""
    )
url = (
    '{token_request_uri}?response_type={response_type}&client_id={client_id}&redirect_uri={redirect_uri}&scope={scope}'
    .format(token_request_uri=token_request_uri, response_type=
    response_type, client_id=client_id, redirect_uri=redirect_uri, scope=scope)
    )
return HttpResponseRedirect(url)
Python Oauth2 — войдите через Google