Why can't I see my client's store while installing a custom app?

Solved

Why can't I see my client's store while installing a custom app?

aditodkar
Shopify Partner
16 0 3

Hello everyone, 

I am following this tutorial https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/embed-your-app-in-shopify I am able to run application and all the steps are working fine for me. Now if I want to test my application on some shopify store which is live on production then is it possible to install my custom application and test it? I have requested my client's to give me access to shopify store and they have accepted my request. Now while installing the custom application I cannot see my client's shopify store why so? 

shoppy.png

Thanks & Regards,

Aditya

Accepted Solution (1)

HymnZ
Shopify Partner
399 6 49

This is an accepted solution.

The old way of installing unlisted public apps has been removed by Shopify.

If you want to test your app on a production store, you'll have to duplicate your app and when you're creating the app in Shopify's partner dashboard select "custom app" and use this option

HymnZ_0-1622966473288.png

 

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz

View solution in original post

Replies 11 (11)

HymnZ
Shopify Partner
399 6 49

This is an accepted solution.

The old way of installing unlisted public apps has been removed by Shopify.

If you want to test your app on a production store, you'll have to duplicate your app and when you're creating the app in Shopify's partner dashboard select "custom app" and use this option

HymnZ_0-1622966473288.png

 

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz
aditodkar
Shopify Partner
16 0 3

If I want to access any shopify store data then can I make use of this package https://github.com/Shopify/shopify-node-api I have already created custom app on store and shopify store as well on partner dashboard. So now if I want to fetch products via Admin API then can I use above package? Also one more question can I use same package to access data of any other shopify store if the owner of that shopify store has already added me as a collaborator to that shopify store? 

 

Thanks and Regards,

Aditya

HymnZ
Shopify Partner
399 6 49

You'll still need API keys to follow through with each store. So, unless you have the merchant install the app you will not have API keys.

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz
aditodkar
Shopify Partner
16 0 3

> You'll still need API keys to follow through with each store. So, unless you have the merchant install the app you will not have API keys.

But it is possible to fetch data using this https://github.com/Shopify/shopify-node-api for any specific shopify store once I have API key and secret is that right?

But if I use this package then how to generate access token? I am unable to perform OAuth using this package https://github.com/Shopify/shopify-node-api 

For creating client for any shopify store I need to perform OAuth I have created 2 routes (login and auth/callback) mentioned here https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md#add-a-route-to-start-oauth but it is not working. Any idea how can it perform OAuth and generate client for shopify store so that I can access shopify store data via Admin APIs.

Thanks and Regards,

Aditya

HymnZ
Shopify Partner
399 6 49

What is your issue? Are you not able to install the app or not able to use APIs?

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz
aditodkar
Shopify Partner
16 0 3

I am not able to do these 2 actions:
1) Adding route to start oAuth https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md#add-a-route-to-start-oauth

2) Add your OAuth callback route https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md#add-your-oauth-callback-ro...

I have setup everything as mentioned in docs but not able to perform OAuth using shopify node-express. Once OAuth is successful I want to create session and then make different routes to fetch data from shopify store via Admin API's

code snippet: 

 

// src/index.ts
import express from 'express';
import Shopify, { ApiVersion, AuthQuery } from '@shopify/shopify-api';
require('dotenv').config();

const app = express();

const { API_KEY, API_SECRET_KEY, SCOPES, SHOP, HOST } = process.env;

Shopify.Context.initialize({
  API_KEY,
  API_SECRET_KEY,
  SCOPES: [SCOPES],
  HOST_NAME: HOST,
  IS_EMBEDDED_APP: true,
  API_VERSION: ApiVersion.April21 // all supported versions are available, as well as "unstable" and "unversioned"
});

app.get('/login', async (req, res) => {
  let authRoute = await Shopify.Auth.beginAuth(req, res, SHOP, '/auth/callback', true);
  return res.redirect(authRoute);
})

app.get('/auth/callback', async (req, res) => {
  try {
    await Shopify.Auth.validateAuthCallback(req, res, req.query as unknown as AuthQuery); // req.query must be cast to unkown and then AuthQuery in order to be accepted
  } catch (error) {
    console.error(error); // in practice these should be handled more gracefully
  }
  return res.redirect('/'); // wherever you want your user to end up after OAuth completes
});

app.get('/getproducts', async (req, res) => {
  const session = await Shopify.Utils.loadCurrentSession(req, res);
  console.log("session", session)

  // Create a new client for the specified shop.
  const client = new Shopify.Clients.Rest(session.shop, session.accessToken);
  // Use `client.get` to request the specified Shopify REST API endpoint, in this case `products`.
  const products = await client.get({
    path: 'products',
  });

  console.log("session", session)

  console.log("client", client)

  console.log("products", products)

});

app.listen(3000, () => {
  console.log('your app is now listening on port 3000');
});

 

 

In above code it is saying shop of undefined which means session is not created. I think I am doing some wrong in OAuth process. Can you please let me know what I am doing wrong in above code?

Thanks and Regards,

Aditya 

aditodkar
Shopify Partner
16 0 3

With above code setup if I go to {your ngrok address}/login route (in browser) then I see 302 in ngrok terminal. Next I go to this route {your ngrok address}/auth/callback (in browser). After that I go to {your ngrok address}/oauth/begin now it gives me error in nodejs terminal:

CookieNotFound [Error]: Cannot complete OAuth process. Could not find an OAuth cookie for shop url: undefined

How should I solve this issue? Any suggestions/idea?

 

Thanks & Regards,

Aditya

HymnZ
Shopify Partner
399 6 49

I couldn't figure out this library when I was building apps. I moved to manual verification using expressjs routes and cryptojs.

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz
aditodkar
Shopify Partner
16 0 3

Ok then I will also go with standard approach instead of using some shopify npm packages. I want to generate access token for admin API's I was following this article https://shopify.dev/tutorials/authenticate-with-oauth in step 2 they have mentioned redirect_uri but I have general question this redirect_uri will always change when ngrok is refreshed so how will it work exactly? How can I generate access token for admin API's in such cases? I am following this article https://shopify.dev/docs/admin-api/getting-started in that X-Shopify-Access-Token is required. If you don't mind can I contact you on skype?

Regards,

Aditya

CatenateValerio
Shopify Partner
1 0 0

I followed your suggestion duplicating the app and generated a new single-merchant-link, the generation of the link is successful but when I try to use it on a new store, it redirect me to "Example Domain.com" instead of the install page.
Is it a bug in the link generation or there is some restriction that I'm not aware of?

HymnZ
Shopify Partner
399 6 49

No. Most likely the shop has been shut down. If the shop is still active, have the owner install the app via this link as you may not have permission.

My speciality lies in making Shopify work for your requirements, not the other way round. HMU on email: hymnz@outlook.com or on skype: hymnzzy

If you like my work, consider supporting me 🙂 https://www.buymeacoffee.com/hymnz