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

[Feature]: Add support for client credentials grant #1362

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

fwaadahmad1
Copy link
Contributor

@fwaadahmad1 fwaadahmad1 commented Feb 18, 2025

WHY are these changes introduced?

WHAT is this pull request doing?

  • No UI/UX Changes
  • Introduces Client credentials token acquisition flow.

How has this been tested?

What should the reviewers focus on?

  • Existing token_exchage and oauth flows both use create_session file, see that changes do not affect the current behaviour of the library.
  • ShopifyApi::Auth::Session.from now supports expiration for both online and offline tokens.

Setup Instructions

  1. Setup a Spin instance with constellation partners:dev
    • Run spin up partners:dev --wait
  2. clone the client-creds-tophat-ruby app
  3. clone the shopify-api-ruby library and checkout to current branch.

Tophatting

Video

Instructions

  1. Make sure the path in Gemfile, in client-creds-tophat-ruby app is correct. It should be a relative path to your locally cloned shopify-api-ruby library.
gem "shopify_api", path: "../../shopify-api-ruby"
  1. publish the app to your spin instance by running
shopify app dev --reset
  1. Install the app to your store.
  2. Open Developer tools console.
  3. Click the button Perform Client Credentials Request, in your app
    • This button will call an api on the ruby server that will initiate the client_credentials flow from shopify-api-ruby library and then return the response.
    • The logs for this api call can be seen in the app's console
image
  1. Check the console for the response containing an access_token, and expires keys.
image

Checklist:

  • My commit message follow the pattern described in here
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the project documentation.
  • I have added a changelog line.

@fwaadahmad1 fwaadahmad1 force-pushed the fa/develop-app-access-622 branch from 91bde9d to 59bb68c Compare February 18, 2025 17:15
@fwaadahmad1 fwaadahmad1 changed the title Fa/develop app access 622 [Feature]: added support client credentials in shopify-api-ruby #1362 Feb 18, 2025
@fwaadahmad1 fwaadahmad1 changed the title [Feature]: added support client credentials in shopify-api-ruby #1362 [Feature]: added support client credentials in shopify-api-ruby Feb 18, 2025
@fwaadahmad1 fwaadahmad1 changed the title [Feature]: added support client credentials in shopify-api-ruby [Feature]: Add support for client credentials grant Feb 18, 2025
@fwaadahmad1 fwaadahmad1 marked this pull request as ready for review February 19, 2025 16:39
@fwaadahmad1 fwaadahmad1 requested a review from a team as a code owner February 19, 2025 16:39
Copy link
Contributor

@lizkenyon lizkenyon left a comment

Choose a reason for hiding this comment

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

thank you! ⭐

@fwaadahmad1 fwaadahmad1 force-pushed the fa/develop-app-access-622 branch from 59bb68c to a51dfaa Compare February 20, 2025 16:24
Copy link

@RyanDJLee RyanDJLee left a comment

Choose a reason for hiding this comment

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

Had some minor comments, but looks great!

@fwaadahmad1 fwaadahmad1 force-pushed the fa/develop-app-access-622 branch from a51dfaa to 67d5a0c Compare February 21, 2025 17:35
@fwaadahmad1 fwaadahmad1 force-pushed the fa/develop-app-access-622 branch from 67d5a0c to 89869ec Compare February 21, 2025 19:54
@fwaadahmad1 fwaadahmad1 merged commit 33e5cf8 into main Feb 21, 2025
9 checks passed
@fwaadahmad1 fwaadahmad1 deleted the fa/develop-app-access-622 branch February 21, 2025 20:32
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.

4 participants