mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
#25: Patched up access token management.
This commit is contained in:
parent
0677d93e89
commit
7d18c8745f
1 changed files with 4 additions and 3 deletions
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
namespace Poniverse\Ponyfm\Models;
|
namespace Poniverse\Ponyfm\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use DB;
|
use DB;
|
||||||
use Gravatar;
|
use Gravatar;
|
||||||
use Illuminate\Auth\Authenticatable;
|
use Illuminate\Auth\Authenticatable;
|
||||||
|
@ -168,7 +169,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||||
return new AccessToken([
|
return new AccessToken([
|
||||||
'access_token' => $accessTokenRecord->access_token,
|
'access_token' => $accessTokenRecord->access_token,
|
||||||
'refresh_token' => $accessTokenRecord->refresh_token,
|
'refresh_token' => $accessTokenRecord->refresh_token,
|
||||||
'expires' => $accessTokenRecord->expires,
|
'expires' => Carbon::createFromFormat('Y-m-d H:i:s', $accessTokenRecord->expires)->timestamp,
|
||||||
'resource_owner_id' => $accessTokenRecord->external_user_id,
|
'resource_owner_id' => $accessTokenRecord->external_user_id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -184,8 +185,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||||
->update([
|
->update([
|
||||||
'access_token' => $accessToken->getToken(),
|
'access_token' => $accessToken->getToken(),
|
||||||
'refresh_token' => $accessToken->getRefreshToken(),
|
'refresh_token' => $accessToken->getRefreshToken(),
|
||||||
'expires' => $accessToken->getExpires(),
|
'expires' => Carbon::createFromTimestampUTC($accessToken->getExpires()),
|
||||||
'resource_owner_id' => $accessToken->getResourceOwnerId(),
|
// NOTE: external_user_id does not get updated!
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue