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

Public Auth For Theme Extension #300

Closed
pkyek1 opened this issue Aug 10, 2023 · 1 comment
Closed

Public Auth For Theme Extension #300

pkyek1 opened this issue Aug 10, 2023 · 1 comment

Comments

@pkyek1
Copy link

pkyek1 commented Aug 10, 2023

i have created a a api in this new remix template

api.public.cart.jsx

and used following code

import shopify from '../shopify.server';
import {json} from '@remix-run/node';
import {getNotes} from '../models/notes';

export const loader = async ({request}) => {
const {sessionToken, cors} = await shopify.authenticate.public(request);

// E.g: Get notes using the shops admin domain
return cors(json(await getNotes(sessionToken.iss)));
};

but when i call this api using theme app extension in script it returning 401 error

i have also tried diretly calling it , returns same 401 error

i checked the logs

it return warning

19:34:20 │ remix │ [shopify-app/INFO] Authenticating public request
19:34:20 │ remix │ GET /api/public/cart 401 - - 7.807 ms

please help

@byrichardpowell
Copy link
Contributor

Thanks for opening an issue.

Closing this as a duplicate of #295

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

No branches or pull requests

2 participants