How to solve The JWT string must have two dots.

 When i am trying to get the product list with ../api/v1/product API with passing valid token. i am receiving the below response. {  "errors":   [  {   "code":"9",   "status":"401",   "title":"The resource owner or authorization server denied the request.",   "detail":"The JWT string must have two dots"   }  ] }

The curl request is like following.

 

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, ‘GET’);
        curl_setopt(
            $curl,
            CURLOPT_HTTPHEADER,
            [‘Content-Type: application/json’,
             ‘Authorization: Bearer {$token}’
            ]
        );

So, where is your actual access token? => https://docs.shopware.com/en/shopware-platform-dev-en/api/admin-authentication?category=shopware-platform-dev-en/api#access-token

And as you can see: your token is of course not valid. Did you passed maybe the refresh token instead of the access token?

Maybe this helps => https://github.com/laravel/passport/issues/60

Or this => https://www.google.com/search?q=The+JWT+string+must+have+two+dots&oq=The+JWT+string+must+have+two+dots&aqs=chrome…69i57j0l3j69i60.390j0j7&sourceid=chrome&ie=UTF-8

@Shopwareianer schrieb:

So, where is your actual access token? => https://docs.shopware.com/en/shopware-platform-dev-en/api/admin-authentication?category=shopware-platform-dev-en/api#access-token

And as you can see: your token is of course not valid. Did you passed the maybe the refresh token instead of the access token?

Maybe this helps => https://github.com/laravel/passport/issues/60

Or this => https://www.google.com/search?q=The+JWT+string+must+have+two+dots&oq=The+JWT+string+must+have+two+dots&aqs=chrome…69i57j0l3j69i60.390j0j7&sourceid=chrome&ie=UTF-8

 

Yes @Shopwareianer, you are right. i was passing the wrong token. now i am able to fetch the product list, thank you so much for your valuable response.

I have also the same problem.
I am calling the API with curl like this:

curl -H „Authorization: Bearer TGx4cUwyQjJUbzVMMHZBWjBmUkQ3WUtGenVsSjU1Zk9Gb25IMEY“ -H „Content-Type: application/json“ https://localhost/api/v1/product -k

Whereas the passed Bearer token I got from http://localhost/admin#/ and then Settings->System->Integrations (Secret access key)