Open g-mo opened 2 years ago
@g-mo this is a rather tricky issue it seems. It is not always obvious when a new instance of the connection class gets created, and when the updated token needs to be passed.
From a user perspective- I am inclined to not tie a token to an object instance, but make it a global property instead. The case where you would want to have multiple connections with different keys seems somewhat niche- and it seems more intuitive to me that once a User sets a new Token - the get_token function just returns that token.
Complication is that currently tokens are also stored in the header parts of the sofarconnection objects, which would not automatically get updated on a change of state. Maybe adding the token to the header should be left to the point where we do a call to get/post etc.?
@tcj for visibility
When using
custom_token
to initializeSofarApi
, the custom token does not get passed into the Spotter workers. The Spotter workers will then each create their own instance ofSofarApi
that uses theWF_API_TOKEN
environment variable, possibly resulting in failed queries due to using a wrong or missing token