Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes Configuration#access_token to avoid stale/duplicate tokens #14

Merged
merged 3 commits into from
Jul 19, 2019

Conversation

prsimp
Copy link
Contributor

@prsimp prsimp commented Jul 16, 2019

Rather than allowing the access token to be set via Configuration, we'll always either grab it from the cache (if configured) or generate a new token from the Help Scout API. This also prevents the situation where the configuration instance and the api instance have "competing" tokens.

We can still manually set the token for testing purposes via HelpScout.api.access_token=.

Resolves #12

Rather than allowing the Access Token to be set via Configuration, we'll
always either grab it from the cache (if configured) or generate a new
token from the Help Scout API. This also prevents the situation where
the configuration instance and the api instance have competing tokens.

We can still manually set the token for testing purposes via
`HelpScout.api.access_token=`.
@prsimp prsimp requested review from andremleblanc and jcypret July 16, 2019 18:40
@prsimp prsimp added this to the v2.0.0 milestone Jul 16, 2019
Copy link
Contributor

@andremleblanc andremleblanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pretty straight-forward. I'm still not 100% confident there's not another way to get tokens out of sync, but this eliminates the most obvious way for sure.

@prsimp prsimp mentioned this pull request Jul 19, 2019
Copy link

@jcypret jcypret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes make sense. Tested out locally making a variety of requests, resets, and setting the access token to nil; everything I tried worked as expected. LGTM 👍

@prsimp prsimp merged commit 00a6d93 into master Jul 19, 2019
@prsimp prsimp deleted the remove-access-token-config branch July 19, 2019 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure Cached Access Token Value is Used
3 participants