Clarification on access token expiration

My access token expired on me today, no letter, no email, no text… just ran off.

It’s the making of a country music song… "My token departed, it was a heck of a time…

2 Likes

Hi Dave;

Is that possible to request the access token expiration time now upon login or still 90 days default. If possible please let me know how. Thanks.

You can use CLI via particle token or look in the docs for the API
https://docs.particle.io/reference/api/#generate-an-access-token

Your default token for Build will live forever - unless you revoke it.

@ScruffR, I saw that document. I did not see any place I can make a curl request so that my access token won’t expire. I have tried this:

$ curl https://api.particle.io/oauth/token -u particle:particle -d grant_type=password -d username=joe@example.com -d password=SuperSecret

It is returning “expires_in”: 7776000

Thanks.

Have you tried the particle token way?
This should provide some better readable info.

That number is seconds till expiry (7776000sec = 90days)

BTW, that doc states

1 Like

@ScruffR, yes, I saw 0 means forever. The question was how do I get it to return 0.

That would be the one to list all your tokens
https://docs.particle.io/reference/api/#list-access-tokens

And when generating a new one, you’d need to add expires_in=0

curl https://api.particle.io/oauth/token -u particle:particle -d grant_type=password -d username=joe@example.com -d password=SuperSecret -d expires_in=0

Then it will return 0!

1 Like

@ScruffR, thanks. that helps.