python - Accessing Firebase DB from Google App Engine -
i having trouble accessing firebase db gae app. works fine when running locally, deployed gae (*.appspot.com) unauthorized error firebase. there obvious thing missed...
this _get_http() function use. works fine (after doing 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 authed http object.""" http = httplib2.http() # use application default credentials make 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
the error firebase is:
{u'error': u'unauthorized request.'}
the log gae looks includes this:
11:14:43.835 attempting refresh obtain initial access_token 11:14:44.625 refreshing due 401 (attempt 1/2) 11:14:44.966 refreshing due 401 (attempt 2/2)
got it! had commented out 'https://www.googleapis.com/auth/userinfo.email'
thinking unnecessary. wrong. enabling again, bingo!
Comments
Post a Comment