What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

What is the default expiry date on customerAccessTokens and can we change them?

What is the default expiry date on customerAccessTokens and can we change them?

Liquidator3358
Explorer
44 1 16

Hey guys,

 

I may be overlooking this but I was wondering where I can find the default expiration date for customerAccessTokens?  I think I stumbled upon it once but I can't seem to find it again the documentation.  Also, is there a way to generate an access token while declaring our own expiration date?

 

I plan on referencing my JWT's with an id in localStorage and I want to refresh them as much as possible (refresh on page render and ideally, after 10 minutes).  Since I am using localStorage, cycling the JWTs on the client side is an absolute must.

Replies 5 (5)

dogowner
Shopify Partner
59 5 8

I'm not very familiar with this API but isn't the expiration date on the object itself alongside the access token?  Is this the customerAccessToken you are referring to?

 

 

Liquidator3358
Explorer
44 1 16

yes lol I have repeatedly used the token alone so many times in development, I forgot the intial response included the expiry.  That's called a brain fart.  Now, can I shorten it is the question?

dogowner
Shopify Partner
59 5 8

I'm not sure.  You mean request a new one and expire the old one ?

Liquidator3358
Explorer
44 1 16

No, I mean setting the default expiry time when you generate a new token.  You can simply renew a token whenever you want, so there is a lot of control that can come from that.  I was just curious if we could set our own expiry parameters.

cms1209
New Member
4 0 0

sorry for pinging you after 2 years - but did you find any solution to this problem (of setting our own token expiry time)??