2017-05-31 67 views
0

!!私は、Djangoの11.1にoauth2clientドキュメントから次のビューを実装:ジャンゴ&Googleの認証エラー400(のOAuth2エラー)が1

@oauth_required 
def get_profile_required(request): 
    resp, content = request.oauth.http.request(
     'https://www.googleapis.com/plus/v1/people/me') 
    return HttpResponse(content) 


@oauth_enabled 
def get_profile_optional(request): 
    if request.oauth.has_credentials(): 
     # this could be passed into a view 
     # request.oauth.http is also initialized 
     return HttpResponse('User email: {}'.format(
      request.oauth.credentials.id_token['email'])) 
    else: 
     return HttpResponse(
      'Here is an OAuth Authorize link:<a href="{}">Authorize</a>' 
      .format(request.oauth.get_authorize_redirect())) 

そして、私がしようとするとページが正しく動作しているように見えますが、流れを通って、私はそれがError: redirect_uri_mismatchだと言って400のエラーを取得します。私は自分のドメインを鍵の資格証明セクションに追加しようとしましたが、私はそれを見つけることができません。ここに私が見ているもののスクリーンショットがあります: Oauth setup page

私は他の場所で見るべきですか?これは権限の問題ですか?

答えて

0

どうやら、私はApplication Typeの「その他」を「Webアプリケーション」ではなくOauth ClientID作成ページで選択していました。これを行うことで問題が解決しました。

関連する問題