transition-zero / tz-client

A client repository for accessing FEO data programmatically.
https://docs.feo.transitionzero.org
Apache License 2.0
22 stars 4 forks source link

[ENG-415]Fix/login repeat #109

Closed a-cass closed 10 months ago

a-cass commented 10 months ago

Description

Please explain the changes you made here.

I have replaced the Client's token attribute with an auth class. This class intercepts requests, ensuring the appropriate headers are attached. When instantiated, it will look for a token file and use that. If this file doesnt exist, no auth will be available until the user logs in. When users excecute a query whilst no auth file is available and they have not logged in a FileNotFoundError is raised instructing them to login:

image

Additionally, the auth class will catch authentication errors due to expired access tokens and issue a refresh token request, updating the client's stored access token.

Checklist

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
feo-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2023 3:31pm
notion-workspace[bot] commented 10 months ago

Logging in again doesn’t change client token.