2017-04-07 14 views
0

GAE 앱에서 Firebase DB에 액세스하는 데 문제가 있습니다. 로컬에서 실행 중이지만 GAE (* .appspot.com)에 배포하면 Firebase에서 승인되지 않은 오류가 발생합니다. 내가 놓친 가능성이 있습니다 ...Google App Engine에서 Firebase DB에 액세스

이것은 제가 사용하는 _get_http() 함수입니다. 그것은 (gcloud beta auth application-default login를 수행 한 후) 잘 작동

def _get_http(): 
    _FIREBASE_SCOPES = [ 
    'https://www.googleapis.com/auth/firebase.database', 
    #'https://www.googleapis.com/auth/userinfo.email' 
    ] 

    """Provides an authed http object.""" 
    http = httplib2.Http() 

    # Use application default credentials to make the Firebase calls 
    # https://firebase.google.com/docs/reference/rest/database/user-auth 
    creds = GoogleCredentials.get_application_default().create_scoped(_FIREBASE_SCOPES) 

    creds.authorize(http) 

    return http 

내가 중포 기지에서 돌아 오기 오류 :

{u'error': u'Unauthorized request.'} 
GAE에서 로그 보이는

이 포함

11:14:43.835 
Attempting refresh to obtain initial access_token 
11:14:44.625 
Refreshing due to a 401 (attempt 1/2) 
11:14:44.966 
Refreshing due to a 401 (attempt 2/2) 

답변

1

가 알았어요! 나는 그것이 불필요하다고 생각하는 'https://www.googleapis.com/auth/userinfo.email'을 주석 처리했다. 잘못된. 다시 사용하도록 설정하면 빙고!

관련 문제