These messages are related to the fact that the endpoint library is trying to automatically identify the user from the Authorization header so that it can provide endpoints.get_current_user ( source ). It can do this automatically when the Authorization header contains a carrier token, which is a valid Google OAuth2 access token or Android ID token.
Simply put, this is not a mistake; it simply cannot automatically process your authorization header. There is no big deal since you are setting off on your own through JWT.
For JWT, you can still use the Authorization header and independently verify the JWT using PyJWT (for installing third-party packages, see here ).
Here is the full sample:
import logging import endpoints from protorpc import messages from protorpc import message_types from protorpc import remote import jwt class TestMessage(messages.Message): message = messages.StringField(1) @endpoints.api(name='example', version='v1') class ExampleApi(remote.Service): @endpoints.method(message_types.VoidMessage, TestMessage, http_method='GET') def auth(self, unused_request):
You can check this with the self-generated jwt token:
$ python -c "import jwt; print jwt.encode({'some': 'data'}, 'secret')" eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoiZGF0YSJ9.g1aG08iQyPPwCTJHCxRrkKoYmLiHbBNdarcBQkCPMG4
Then use httpie to make the request:
$ http GET :8080/_ah/api/example/v1/auth Authorization:'Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoiZGF0YSJ9.g1aG08iQyPPwCTJHCxRrkKoYmLiHbBNdarcBQkCPMG4'
If you do not like to look at endpoint logs about the impossibility of checking the token every time, you can use your own header, for example X-Auth .
Jon Wayne Parrott Aug 6 '15 at 20:02 2015-08-06 20:02
source share