Skip to content

Commit

Permalink
Remove cache expire setting, access token is valid for 1 minute less …
Browse files Browse the repository at this point in the history
…than the expires_in attribute
  • Loading branch information
danielvijge committed Nov 17, 2024
1 parent e5c15a2 commit ce13aa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Oauth2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ sub getAuthorizationToken {
my $response = shift;
my $result = eval { from_json($response->content) };

$cache->set('access_token', $result->{access_token}, 30);
$cache->set('access_token', $result->{access_token}, $result->{expires_in} - 60);
$cache->set('refresh_token', $result->{refresh_token}, META_CACHE_TTL);
},
sub {
Expand Down Expand Up @@ -141,7 +141,7 @@ sub getAccessTokenWithRefreshToken {
$log->debug('Successful request for refresh_token');
my $response = shift;
my $result = eval { from_json($response->content) };
$cache->set('access_token', $result->{access_token}, 30);
$cache->set('access_token', $result->{access_token}, $result->{expires_in} - 60);
$cache->set('refresh_token', $result->{refresh_token}, META_CACHE_TTL);
$cb->(@params) if $cb;
},
Expand Down

0 comments on commit ce13aa5

Please sign in to comment.