Shopify/shopify-api-php

Shopify\Exception\MissingArgumentException: Missing Authorization key in headers array in file

greatkanedo opened this issue · 7 comments

Issue summary

Write a short description of the issue here ↓
I get an error
Shopify\Exception\MissingArgumentException: Missing Authorization key in headers array in file D:\project\aicclaravel\vendor\shopify\shopify-api\src\Auth\OAuth.php on line 226

But when I change the Authorization param like this:

        Context::initialize(
            config('oauth.appKeyShopify'),
            config('oauth.appSecretShopify'),
            config('oauth.appSecretScopes'),
            config('oauth.appHostName'),
            new FileSessionStorage('../storage/framework/sessions')
        );

        $headers = [
            'Authorization' => $token['access_token'],
        ];

        $this->shopifySession = Utils::loadCurrentSession(
            $headers,
            request()->cookies->all(),
            true
        );

I get an new error:

Missing Bearer token in authorization header

But when I change this code like this:
$headers = [
'Authorization' => "Bearer {$token['access_token']}",
];

I get an new error:

Wrong number of segments

When I review the api source code, I see this:

    $tks = \explode('.', $jwt);
    if (\count($tks) !== 3) {
        throw new UnexpectedValueException('Wrong number of segments');
    }

"count($tks) !== 3" let me feel important, What param will be, only the hosts, So I change code like this:

        $headers = [
            'Authorization' => "Bearer {$token['shop_host']}",  // xxx..myshopify.com
        ];

I get new error like this:

Syntax error, malformed JSON

with vendor\firebase\php-jwt\src\JWT.php:517.

Help me, PLZ.

@greatkanedo Have you got the solution for this am facing same issue

@greatkanedo , @PencilaPravya did you get the solution ?

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

@greatkanedo Have you got the solution for this am facing same issue

Sorry, I can't fix it. have a good day.

@Sharifur Sorry, I can't fix it. have a good day.

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

We are closing this issue because it has been inactive for a few months.
This probably means that it is not reproducible or it has been fixed in a newer version.
If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.

If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines

Thank you!