Micro
Micro

Reputation: 10891

Java - Google Cloud Endpoints custom authentication with sessions

I like Google Cloud Endpoints but I do not want to use the OAUTH2 authentication with Google Accounts.

Instead, my idea is to create my own authentication. Upon successful login, I would like the client to receive a unique session key that it can then use for all authenticated future calls for a given period.

Is there some established way to do this with Google Cloud Endpoints? Or has someone achieved something similar themselves?

Thank you.

Upvotes: 0

Views: 105

Answers (1)

Yuriy N.
Yuriy N.

Reputation: 6137

In general what you need to:

1) on server side in login method generate session key, store it (indexed) with your custom User object to datastore and return from method;

2) on client side -- store this key as Cookie in browser with expiration time of your choice.

3) send session key (take it from cookie) as custom header (example)

4) on server side in all methods (except login()) add your own Authentificator. In authenticate method compare key from request to one you stored.

Upvotes: 1

Related Questions