thephpleague / oauth2-server

A spec compliant, secure by default PHP OAuth 2.0 Server
https://oauth2.thephpleague.com
MIT License
6.52k stars 1.12k forks source link

refresh token ttl after generating the token #1218

Closed ceresaconsultoria closed 3 years ago

ceresaconsultoria commented 3 years ago
{
      "token_type": "Bearer",
      "expires_in": 3600,
      "access_token": "[...]",
      "refresh_token": "[...]"
}

how to send the ttl of the refresh token?

only comes the token expire_in.

eugene-borovov commented 3 years ago

This information is encoded in the refresh token.

ceresaconsultoria commented 3 years ago

Don't have a way to send this data with json?

Em sex., 23 de abr. de 2021 às 00:55, Eugene Borovov < @.***> escreveu:

This information is encoded in the refresh token https://github.com/thephpleague/oauth2-server/blob/a60313319786ca17973791dab6cf99f13b43d976/src/ResponseTypes/BearerTokenResponse.php#L41 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thephpleague/oauth2-server/issues/1218#issuecomment-825367693, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMHJ2BM2KZMVI6Y5RD2L5LTKDVU5ANCNFSM43NEAWRQ .

Sephster commented 3 years ago

The refreshTokenGrant has a function setRefreshTokenTTL which you can use to change the default TTL. Hope this helps!

eugene-borovov commented 3 years ago

Don't have a way to send this data with json?

$tokenData = json_decode(base64_decode(strtr(explode('.', $refreshToken['refresh_token'], 3)[1], '-_', '+/')), true)