Google Endpoints API + Chrome Extension returns None for endpoints.get_current_user().user_id()

后端 未结 3 778
渐次进展
渐次进展 2020-12-07 23:59

I am developing Google App Engine application written in Python and using Endpoints API. In conjunction, I am writing a Chrome Extension to interact with the Endpoints API.

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 00:17

    Just in case anyone is here since 1.8.6 and is still trying to use the auth_util.py work around to return the Google profile id. endpoints.token_id now has two methods depending on if the user is on the development server or not.

    When on Google's servers the flow returns the oauth_user and does not hit the tokeninfo endpoint. Therefore no token info is saved in auth_util.py. However, on the dev server it does hit the tokeninfo endpoint so works as expected.

    For me the easiest way to solve this was just to monkey patch endpoints.token_id._is_local_dev and set that to always be true.

提交回复
热议问题