I am using AppEngine Cloud Endpoints with the Javascript client and Google+ Sign In, I am using endpoints.get_current_user()
. Is there a way to check if the user is an AppEngine admin? Similar to users.is_current_user_admin()
in users API.
Thanks
See Google Endpoints API + Chrome Extension returns None for endpoints.get_current_user().user_id() for a long description of the difference between ID tokens and Bearer tokens when performing auth.
If you aren't using an Android application, you can freely use Bearer tokens and not have to worry about some of the limitations of ID tokens.
Right next
get_current_user()
, theoauth
library provides theoauth.is_current_user_admin()
method. Exactly asget_current_user()
, this method calls_maybe_call_get_oauth_user
and then checks a simple environment variable.As mentioned in the other answer:
So if you are only using Bearer tokens, you could do the following