Shopify / shopify_app

A Rails Engine for building Shopify Apps
MIT License
1.74k stars 685 forks source link

Add token exchange concern #1817

Closed zzooeeyy closed 3 months ago

zzooeeyy commented 3 months ago

What this PR does

Tophat: 📹 https://videobin.shopify.io/v/J4j8l2

Happy path for token exchange

Note on what else needs to be implemented in other tasks:

Impact on existing apps:

Checklist

Before submitting the PR, please consider if any of the following are needed:

paulomarg commented 3 months ago

I think this makes sense, assuming the TODOs will be resolved before we release :)

ragalie commented 3 months ago

This looks good to me! One question: should we have unit tests around the TokenExchange class?

paulomarg commented 3 months ago

Great callout, we should definitely add some tests for the new paths.

zzooeeyy commented 3 months ago

This looks good to me! One question: should we have unit tests around the TokenExchange class?

Yes we totally should, I was going to tackle that after we handle all the special invalid token cases. That way we can ensure we have all the test cases and ways to recover in 1 go... I've added that another task so we don't forget about it:

ragalie commented 3 months ago

I was going to tackle that after we handle all the special invalid token cases

I'd encourage you to test the happy path in the happy path PR, and the sad path in the sad path PR! Doing all the tests at once can make it harder to discover what caused errors, whereas doing them more iteratively makes it more obvious when a change is breaking an assumption.

zzooeeyy commented 3 months ago

Thanks @ragalie & @paulomarg -- I've updated this PR with tests!