2017-12-14 15 views
1

idToken이 서버의 클라이언트에서 전송 된 것을 어떻게 확인합니까?firebase verify id 토큰 제공 : Firebase ID 토큰의 "iss"가 잘못되었습니다.

나는 파이썬을 사용하여 docs here을 따르고 있습니다. 기본적으로 emailpassword을 반환하는 클라이언트에 로그인 한 다음 idToken을 확인을 위해 서버에 보내지 만 아래 오류가 발생합니다.

ValueError: Firebase ID token has incorrect "iss" (issuer) claim. Expected " https://securetoken.google.com/myproject " but got " https://identitytoolkit.google.com/ ". Make sure the ID token comes from the same Firebase project as the service account used to authenticate this SDK. See https://firebase.google.com/docs/auth/admin/verify-id-tokens for details on how to retrieve an ID token.

저는 클라이언트와 동일한 프로젝트에서 서비스 계정 json을 생성했음을 확신합니다. 누가 그 문제가 될 수 있는지 아는 사람 있습니까?

내 서버 코드는 다음과 같습니다 : 내가 클라이언트 측에서 잘못된 문서를 다음 보인다

from firebase_admin import credentials, initialize_app, auth 

def is_authenticated(id_token): 
    cred = credentials.Certificate("service-account.json") 
    app = initialize_app(cred) 
    return auth.verify_id_token(id_token, app) 

답변

0

; 결국 나는 this docs을 따라 갔고 다음 코드를 사용하여 확인을 위해 백엔드로 보낸 idToken의 압축을 풉니 다.