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

Add a customer account api example #1126

Merged
merged 4 commits into from
Jul 25, 2023
Merged

Add a customer account api example #1126

merged 4 commits into from
Jul 25, 2023

Conversation

blittle
Copy link
Contributor

@blittle blittle commented Jul 20, 2023

Add an example using the new Customer Account API

Follow the readme instructions to try it out.

@blittle blittle merged commit 9482bc5 into 2023-04 Jul 25, 2023
@blittle blittle deleted the bl-customer-api-example branch July 25, 2023 16:40
This was referenced Jul 25, 2023
@thomasKn
Copy link
Contributor

thomasKn commented Aug 9, 2023

Thanks for this example @blittle

I'm playing with your example and followed the readme.

I updated the .env file with my credentials, I also updated the ngrok command.
Login is working (I can see that I'm connected when I directly hit the Shopify hosted account https://shopify.com/{shopId}/account), but the authorize method keeps crashing when the redirection happens.

I tried with different storefronts and I always get the same error:

image

FrcPpe pushed a commit to FrcPpe/hydrogen that referenced this pull request Aug 13, 2023
session.set('code-verifier', verifier);

loginUrl.searchParams.append('code_challenge', challenge);
loginUrl.searchParams.append('code_challenge_method', 'S256');

Choose a reason for hiding this comment

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

Hi @blittle 👋 -- I'd be interested to know why you implemented PKCE given this is run server side?

origin: string,
) {
const clientId = customerAccountId;
const customerApiClientId = '30243aa5-17c1-465a-8493-944bcc4e88aa';
Copy link

@richardscarrott richardscarrott Aug 24, 2023

Choose a reason for hiding this comment

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

I spent an age trying to figure out why I was getting the following error:

{
   error: 'invalid_request',
   error_description: "Invalid 'scope' value: no useable scope on target application"
}

It turns out it was because I was passing my stores Customer Account API Client ID instead of this magical uuid.

Might be worth updating these docs to include the audience field and mention where to get the value from -- https://shopify.dev/docs/api/customer#step-use-access-token

Aside, thanks for this example -- it certainly helped me 🙌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry @richardscarrott. I agree, this magic uuid is not obvious.

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