diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2025-02-23 17:01:01 -0800 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2025-02-23 17:01:01 -0800 |
commit | d347e8286bae38b3949f6e0f58d8ab8632cd9c0e (patch) | |
tree | 92975f797793f7a1da379cd6274da23cea29bc4a /controllers/auth.php | |
parent | 8ecaed3d2f5a19bf1a5c4cb077658e1bd3bc8438 (diff) |
Track token expirationreauthorize
Force reauthentication after the token expires.
Diffstat (limited to 'controllers/auth.php')
-rw-r--r-- | controllers/auth.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/controllers/auth.php b/controllers/auth.php index 9dcc81d..50dbc02 100644 --- a/controllers/auth.php +++ b/controllers/auth.php @@ -175,6 +175,10 @@ $app->get('/auth/callback', function() use($app) { $user->token_endpoint = $tokenEndpoint; $user->micropub_endpoint = $micropubEndpoint; $user->micropub_access_token = $token['response']['access_token']; + if(is_numeric($token['response']['expires_in'])) { + $expiration = time() + $token['response']['expires_in']; + $user->micropub_token_expiration = date('Y-m-d H:i:s', $expiration); + } $user->micropub_scope = $token['response']['scope']; $user->micropub_response = $token['raw_response']; $user->save(); @@ -236,6 +240,7 @@ $app->post('/auth/reset', function() use($app) { $user->micropub_media_endpoint = ''; $user->micropub_scope = ''; $user->micropub_access_token = ''; + $user->micropub_token_expiration = ''; $user->syndication_targets = ''; $user->supported_post_types = ''; $user->save(); |