Question

I'm currently implementing Google C2DM into my app. It all works well, but I noticed, that the Auth-Token, which I get from https://www.google.com/accounts/ClientLogin on server side doesn't stay valid for a long time (Getting HTTP 401 Unauthorized after a couple of requests / after a couple of minutes).

I don't want to refresh the auth token with every request.

Until now, I thought it would be a good way to store the token in a database for future requests. But now I think, there might be better practices to do.

What would be the best way?

Was it helpful?

Solution

Lifetime of auth token is 2 weeks. I store the token in database and when I get 401, I obtain the new token and persist it in database. There might be better approaches though.

OTHER TIPS

Are you sure "Auth-Token" is your word? If you are developing adndroid side then you require "registration_Id". Yes it is refreshed after some period though the time period is not known.
Check here for more info here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top