I perform the steps described in this Questions:
Laravel's 5.3 passport and api routes
Everything works fine from the routes of the api, I can register new users, read their data etc etc.
Then add this command on AuthServiceProvider
Passport::tokensExpireIn(Carbon::now()->addMinute(2)); Passport::refreshTokensExpireIn(Carbon::now()->addDays(1));
i login in postman in url {{url}}/oauth/token
Body: application/x-www-form-urlencoded
{
grant_type : 'password'
client_id : {{email with which the user is registered}}
client_secret : {{generate the client secret from the mobile app}}
username : {{email with which the user is registered}}
password : {{password entered by the user}}
scope : ''
}
the response its successful
{
"token_type": "Bearer"
"expires_in": 120
"access_token": {{the access_token}}
"refresh_token": {{the refresh_token}}
}
I try to refresh token life time to one day send to {{url}}/oauth/token
ref => https://laravel.com/docs/5.3/passport#refreshing-tokens
in postman i send
Headers:
Authorization : Bearer {{the access_token}}
Body: application/x-www-form-urlencoded
{
client_secret : {{generate the client secret from the mobile app}}
grant_type : refresh_token
refresh_token : {{the refresh_token}}
client_id : {{email with which the user is registered}}
scope : ''
}
The expected response:
{
"access_token": {{new access_token}}
"token_type": 'Bearer'
"expires_in": 86400
"refresh_token": {{new access_token}}
}
But it does not work as expected, the response its
{
"access_token": {{new access_token}}
"token_type": 'Bearer'
"expires_in": 120
"refresh_token": {{new access_token}}
}