'[API] Invalid API key or access token (unrecognized login or wrong password

Solved
Iciren
Tourist
4 0 1

Hi,

I am been having issue to fetch my store blog data in my app as I kept getting this error:
'[API] Invalid API key or access token (unrecognized login or wrong password

based on this: https://shopify.dev/docs/admin-api/rest/reference/online-store/blog?api[version]=2020-07

But when I enter the blog api in the address bar, I am able to get data to show in the browser.

I did see some post saying to include api key and password in the url. But I cant find any documentation on it. I also would like to know which password needed to be used for that?

0 Likes
neel738
New Member
6 0 0

Are you using a public app?

 

Does your secret key start wit shpss or shpsa

 

0 Likes
Iciren
Tourist
4 0 1

Yes, I am using a public app. Secret key starts with shpss.

0 Likes

This is an accepted solution.

Does your access token have accessMode set to offline? This problem generally occurs as access tokens are short-lived and set to online accessMode by default and expire in sometime

Read More about Offline Access Here

If you are using shopify-koa-auth you can set it here ->

 

app.use(
  shopifyAuth({
    // if specified, mounts the routes off of the given path
    // eg. /shopify/auth, /shopify/auth/callback
    // defaults to ''
    prefix: '/shopify',
    // your shopify app api key
    apiKey: SHOPIFY_API_KEY,
    // your shopify app secret
    secret: SHOPIFY_SECRET,
    // scopes to request on the merchants store
    scopes: ['write_orders, write_products'],
    // set access mode, default is 'online'
    accessMode: 'offline',
    // callback for when auth is completed
    afterAuth(ctx) {
      const {shop, accessToken} = ctx.session;
 
      console.log('We did it!', accessToken);
 
      ctx.redirect('/');
    },
  }),
);

 

 

 

- Looking to Automate Support on FB Messenger? Install our Messenger Marketing & Support App
- Want to embed Instagram Stories on your store? Install our Instagram Stories & Highlights App
- Have more questions? Feel free to email me.
- My reply helped? Click Like to show me some love!
Fabrice3
Tourist
5 0 2

Thanks to your reply above, was able to solve issue on scheduling background jobs.

In the documentation, it says accessMode is 'offline' by default but it is not the case!