Skip to content

Throw an exception if the access token request failed #219

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

Merged
merged 3 commits into from
Jun 15, 2021

Conversation

liamjcooper
Copy link
Contributor

Rather than returning null if the access token request fails, the getAccessToken() method in AuthHelper.php should throw an SdkException so that when the method is invoked in a try-catch the developer can choose how to act upon a bad request (usually HTTP 400).

This can happen when trying to request an access token twice with the same authorisation code, which can happen if the user installing the Shopify app refreshes the callback route. The user might do this by accident, by using page navigation in their browser or when the developers app crashes on that route. If this does happen, then the developer may choose to redirect them back to Shopify safely, rather than trying to move ahead with using a null access token.

@tareqtms tareqtms merged commit b7dc4b7 into phpclassic:master Jun 15, 2021
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.

2 participants