mardi 30 avril 2019

Laravel Passport Client Credentials Grant

I use Laravel Passport for my API authentication. I have already set up a Password Credentials Grant and it works. Now I need a Client Credentials Grant for machine-to-machine authentication.
I created a new client with php artisan passport:client --client. I tried to make a request to /oauth/token with this body (with Insomnia):

{
    "client_id":3,
    "secret":"wJWuVVydkHIQQ6gC7xvd0eEKytIFAD3pa149e6TR",
    "grant_type":"client_credentials"
}

That's the response i get from Passport:

{
  "error": "invalid_client",
  "error_description": "Client authentication failed",
  "message": "Client authentication failed"
}

Does anyone have any idea why it is an invalid client?
This is the entry in the oauth_clients table for my client, exported as json:

{
    "id":"3",
    "user_id":null,
    "name":"ClientCredentials Grant Client",
    "secret":"wJWuVVydkHIQQ6gC7xvd0eEKytIFAD3pa149e6TR",
    "redirect":"",
    "personal_access_client":"0",
    "password_client":"0",
    "revoked":"0",
    "created_at":"2019-04-30 17:06:17",
    "updated_at":"2019-04-30 17:06:17"
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire