I found `is_token_valid` always returns `False` be...
# singer-tap-development
h
I found
is_token_valid
always returns
False
because
self.last_refreshed
is always
None
when the stream is initialized. Does this mean the
OAuthAuthenticator
is being reinitialized every time? Guessing that’s wrong, right?
@aaronsteers Is there a reason why you make the config read only during the tap’s execution? Seems like it is causing a few issues for me 😉
a
Hi, @hassan_syyid. I appreciate the feedback here and apt questions. Regarding the config, we know the config dictionary will be passed around quite a bit and there was a strong potential for individual streams to accidentally create side effects that would impact others. Are the issues you are running into mostly related to type checking out did you have a use case where you want to intentionally override the config that was send from the user? The pattern I've been using and recommending when I need a proper
dict
is to wrap the config in dict() or cast().
h
Makes sense. My use case is what I mentioned above: I want to persist the same instance of the authenticator for each stream that starts during a given sync. Figured the best way was to “store” that in the config as it is being passed around. Didn’t work though because it’s read only 🙂
a
Totally makes sense. For that use case I do think we should have a more robust solution anyway regarding (1) making sure auth is reused by streams which need it and (2) potentially also bring able to reuse a refresh token across sessions. Much appreciated if you have time to post an issue (or issues) on this. It's definitely on our radar and want to make sure we're properly optimizing this auth flow.
h
Sure