Hi there, I’m using the customer accounts api to authenticate my b2b users from my next js headless storefront hosted on netlify.
My client type is set to public and I am able to successfully retrieve a code from https://shopify.com//auth/oauth/authorize and set the code verifier.
The problem is the second step in the authentication process, the call to
shopify.com/< my store id >/auth/oauth/token is returning 401 unauthorized with a cors error.
I have tried both the https netlify.live domain generated by the netlify cli, as well as an ngrok tunnel, with the respective origins and endpoints set in my application settings, but the result is the same.
Here is my function:
export async function codeToToken(router) {
const code = router.query.code;
const clientId = process.env.NEXT_PUBLIC_SHOPIFY_NEW_CUSTOMER_CLIENT_ID;
const body = new URLSearchParams();
body.append("grant_type", "authorization_code");
body.append("client_id", clientId);
body.append(
"redirect_uri",
`https://
Thanks in advance.
