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

An way to use restApi /graphql library without init the shopifyApp #805

Closed
bbaltatu opened this issue Apr 18, 2024 · 2 comments
Closed

An way to use restApi /graphql library without init the shopifyApp #805

bbaltatu opened this issue Apr 18, 2024 · 2 comments

Comments

@bbaltatu
Copy link

Hi,
I have a special case. My app works with queues where the workers are on other machines.
Now I have to init the workers with shopifyApi({appKey, appToken, .. }) to access the client.rest API. I saw you have @shopify/admin-api-client app but this doesn't have types .

What I like is to do something like this:
const variant = new shopify.rest.Variant({session: session}); variant.product_id = 632910392; variant.option1 = "Yellow"; variant.price = "1.00"; await variant.save({ update: true, });
but not initializing the app with app credentials
const shopify = shopifyApi({ // The next 4 values are typically read from environment variables for added security apiKey: 'APIKeyFromPartnersDashboard', apiSecretKey: 'APISecretFromPartnersDashboard', scopes: ['read_products'], hostName: 'ngrok-tunnel-address', ... });
Is there a workaround for my case?

@lizkenyon
Copy link
Contributor

Hi there 👋

Could you provide me a bit more context on why you cannot initialize the shopifyAPI object? As well as confirm if you have a public or custom/private app? Could you also confirm if you are only using the Shopify API library or are you using the remix or express package as well. Could you also clarify how you are managing your sessions?

A common flow for applications that use deferred jobs, or workers. Is that they will use the offline access tokens for making their requests.

You will still need to create the shopifyAPI object, or app object if using some of our additional libraries, But instead of loading the session object by using your request object, you will use the helper method shopify.session.getOfflineId. Or if you are using the remix package we provide helper functions for getting the session and making API requests in these contexts.

Copy link
Contributor

github-actions bot commented May 8, 2024

We are closing this issue because we did not hear back regarding additional details we needed to resolve this issue. If the issue persists and you are able to provide the missing clarification we need, feel free to respond and reopen this issue.

We appreciate your understanding as we try to manage our number of open issues.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants