JimCurryWang / python-shopee

pyshopee - Shopee Partner API Client for Python
https://pypi.org/project/pyshopee
MIT License
210 stars 82 forks source link

Hi, I have some question about token cached. #50

Open wangcaohong opened 2 years ago

wangcaohong commented 2 years ago

Hi, I have a question about token cached. as we know, The access/refresh_token has an expiration date, do u use redis or other in token cached? such as if token has expired, program will listen to the expired information of Redis and then update the token with refresh_token.

JimCurryWang commented 2 years ago

Hi @The-Wong ,

In the initial design concept, we hope to keep python-shopee as light as possible, so we didn't include the Redis solution in the cache mechanism. However, I think we can just reinitialize the client instance to get the token update again.

# Reinitialize
client = pyshopee.Client( shopid, partnerid, API_key )

I hope this is helpful.

wangcaohong commented 2 years ago

Thank you for your reply, but if refresh_token has expired and not reacquired within 30 days , user just need to re-authorized shop, this is very bad in the user experience.