danreeves / dt-exchange

40 stars 17 forks source link

feat(auth): automatically refresh tokens #21

Closed Chris-Bitler closed 1 year ago

Chris-Bitler commented 1 year ago

Automatically refresh the user authentication tokens on a 30 minute interval to make sure we don't start getting 401's for the store requests

danreeves commented 1 year ago

This looks good, thanks for the PR. I've been wondering if this works or is better included in the background.js file.

Chris-Bitler commented 1 year ago

@danreeves I got wrapped up in other stuff yesterday and forgot about making sure we only refresh it when necessary. Will fix it today

Coconutcoo commented 1 year ago

@danreeves What was the outcome of you leaving it open for a bit?

danreeves commented 1 year ago

@Coconutcoo copy pasting some messages i put in discord:

i had it running in the background while i worked and sometimes it would get stuck on a loading spinner when i tabbed back. i think it's to do with the fetcher getting memoized. i did a little refactor on the branch locally so it pulls out of localStorage every time it tries to fetch and it appears to have resolved that.

opening the laptop again in the morning i got TypeError: Cannot read properties of undefined (reading 'ExpiresIn') in the background thread

danreeves commented 1 year ago

Closing as stale. Feel free to re-open a PR if you make any more progress on it!