Persisting App Access Token


So I’m currently creating a function to subscribe to real-time notification for Twitch.

The problem is, to subscribe to their notification, I need to set up a webhook callback which is almost done, but the thing is I need the app access token, now how would you persist this? or do I even need to persist this? like can I just generate a new app access token for every request I made?

I generate a token
Store the token in redis
And have a service check/remake it when needed and put it back into redis

Then when a thing needs app access it’ll grab it from redis.

I have multiple scripts/servers both cronjob/long form that need a token so I use redis to store the one token to rule them all and they all call from there

I see, so I really need to persist it.

I’ll use the method you mention, I think that’s much better compared to my idea

Thank you

if you only have this one single thing that using a token.

Then generating each time is ok

It’s just considered bad practice.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.