Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Invalid API key or access token

Invalid API key or access token

fahim-ng
Shopify Partner
2 0 0
public function configureTheme(Request $request)
{
$shop = Auth::user();

 

$themes = $shop->api()->rest('GET', '/admin/themes.json');
dd($themes);
$activeThemeId = "";
foreach($themes['body']->container['themes'] as $theme){
if($theme['role'] == "main"){
$activeThemeId = $theme['id'];
}
}
 
}
it returns 
"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)
Please can any one help ?
Replies 2 (2)

Liam
Community Manager
3108 344 899

Can you confirm that the API key and access tokens are both correct and active?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

fahim-ng
Shopify Partner
2 0 0

Yes, I set this in the environment file (SHOPIFY_API_KEY and SHOPIFY_API_SECRET) and utilise middleware (verify.shopify)

when route call.
I get the app user data from ($shop = Auth::user();) but  when get shopify api like $themes = $shop->api()->rest('GET', '/admin/themes.json');
it generates the Invalid API key or access token (unrecognized login or wrong password) error??

Thanks in Advance