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

Solved
Iciren
Tourist
5 0 2

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?

Accepted Solution (1)

Accepted Solutions
mayurc137
Shopify Partner
9 1 5

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('/');
    },
  }),
);

 

 

 

- 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!

View solution in original post

Replies 10 (10)
neel738
New Member
6 0 0

Are you using a public app?

 

Does your secret key start wit shpss or shpsa

 

Iciren
Tourist
5 0 2

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

mayurc137
Shopify Partner
9 1 5

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('/');
    },
  }),
);

 

 

 

- 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!

sanketJ
Shopify Partner
18 0 1

i am facing this error "[API] Invalid API key or access token (unrecognized login or wrong password)" when i call "https://shop.myshopify.com/admin/api/2021-07/graphql.json" in postman 

can we are use shopify in apollo??

if yes then how?

EasierProfit
New Member
2 0 1

@sanketJ wrote:

i am facing this error "[API] Invalid API key or access token (unrecognized login or wrong password)" when i call "https://shop.myshopify.com/admin/api/2021-07/graphql.json" in postman 

can we are use shopify in apollo??

if yes then how?


Today, my app's getting that error hitting the same endpoint. Things were working perfectly yesterday-- I'm not sure if it's on our end or Shopify's.

sanketJ
Shopify Partner
18 0 1

i solved this error 

you can add  the Authorization in header section

currently i am facing this error in node with express js { product: 'Required parameter missing or invalid' } 

anyone have any idea ? how to solve this error

Sweta-Jha
Shopify Partner
3 0 0

While Developing the theme using a Theme kit. I'm facing the same error:

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

Solution: Remove the http/https from the store URL. Again hit the command. 
Shopify Tip: Don't include the URL protocol (HTTP or HTTPS) in the store parameter.

 

Sweta Jha
angeleguiluz
New Member
1 0 1

@Sweta-Jha  I've tried your suggestion, but I get this error: SSL required

Sweta-Jha
Shopify Partner
3 0 0

Are you facing this error while working with the theme kit?
Can you share the detail about your issue?

So, I can help you.

Sweta Jha