larapi icon indicating copy to clipboard operation
larapi copied to clipboard

InvalidCredentialsException when getting access token via POST

Open ateeqdev opened this issue 4 years ago • 0 comments

Steps to Reproduce

  1. Install & configure Larapi
  2. Send a postman request to get the access_token
php artisan serve
curl -X POST http://localhost:8000/login -H 'Content-Type:application/json' -d '
{
    "email":"[email protected]",
    "password":"1234"
}'

Expected Result:

  • The access_token should be returned as response

Actual Result:

  • Infrastructure\\Auth\\Exceptions\\InvalidCredentialsException is thrown in infrastructure/Auth/LoginProxy.php:85

Root Cause

  • $this->apiConsumer->post('/oauth/token', $data); throws an internal Server error in infrastructure/Auth/LoginProxy.php
  • Replicating claims as headers is deprecated and will removed from v4.0. Please manually set the header if you need it replicated.

Resolution

  • composer require lcobucci/jwt=3.3.3
  • laravel/passport uses thephpleague/oauth2-server which uses lcobucci/jwt "3.3.3".

ateeqdev avatar Nov 28 '21 03:11 ateeqdev