I received the following error out of the blue for a Stripe Connect implementation that I built out.
{"error":{"message":"No application matches the supplied client identifier"}}
I describe the context surrounding this error below but I found a simple way to solve this issue. Spoiler alert, I was missing the client_id from my generated authorization URL.
I used the great PHP League’s OAuth 2.0 Client, specifically, I used an officially linked third party provider that used the League’s OAuth 2.0 Client to build out a Stripe OAuth Client visible at https://github.com/adam-paterson/oauth2-stripe.
I used the OAuth 2.0 Stripe Client Provider to generate an authorization URL using the following command:
$provider = new \AdamPaterson\OAuth2\Client\Provider\Stripe([
'clientId' => env('stripe_live_client_id'),
'clientSecret' => env('stripe_live_client_secret'),
'redirectUri' => env('stripe_redirect_uri'),
]);
$authUrl = $provider->getAuthorizationUrl();
After looking into the generated link a bit more and looking through Stripe’s Connect documentation, I found out that I was missing the client_id parameter in the generated authorization URL. My generated URL looked like the below:
https://connect.stripe.com/oauth/authorize?state=28e768c83e749f14a7ca20096420a33f&scope=read_only&response_type=code&approval_prompt=auto&redirect_uri=http%3A%2F%2Fwww.examplewebsite.com%2Fstripe-callback
So, I simply had to add the client_id parameter to the end of the URL and that did the trick! So, I updated the code above to this instead:
$authUrl = $provider->getAuthorizationUrl().'&client_id='.$stripe_live_client_id;
This made the URL appear like the following:
https://connect.stripe.com/oauth/authorize?state=28e768c83e749f14a7ca20096420a33f&scope=read_only&response_type=code&approval_prompt=auto&redirect_uri=http%3A%2F%2Fwww.examplewebsite.com%2Fstripe-callback&client_id=dc_2342adfjfoijsdviewjvowe
After running that, when I clicked on the generated Authorization URL, it directed me to the Stripe Connect form instead of a blank page with that “No application matches the supplied client identifier” error. And, I was able to check off yet another task on my neverending list ;).
UPDATE:
It turns out that the issue was in the instantiation of the class. I had updated Laravel and the way they handle environment/configuration variables changed in the upgrade. The client id wasn’t being provided properly because I was using the newer version of Laravel and was getting the client values using env() instead of config(). So, I added the Stripe Client ID and Client Secret to the services config file and updated the instantiation code to look like the below:
$provider = new \AdamPaterson\OAuth2\Client\Provider\Stripe([
'clientId' => config('services.stripe.client_id'),
'clientSecret' => config('services.stripe.client_secret'),
'redirectUri' => config('services.stripe.redirect_uri'),
]);
$authUrl = $provider->getAuthorizationUrl();
This created the authorization URL that included the client_id, so I was able to remove the addition of the client_id parameter at the end of the $authUrl variable. Finally, got that working as it actually should work, instead of having to add the client_id manually.