| 1 | package LWP::Authen::OAuth2::ServiceProvider::Line::AccessToken; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Line AccessToken | ||||||||||
| 4 | 2 | our $VERSION = '0.20'; # VERSION | |||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use parent 'LWP::Authen::OAuth2::AccessToken::Bearer'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | our $REFRESH_PERIOD = 864000; # 10 days. https://devdocs.line.me/en/#refreshing-access-tokens | |||||||||
| 11 | |||||||||||
| 12 | # Line tokens can be refreshed until the refresh period is over. | ||||||||||
| 13 | 4 | ▶ | sub should_refresh { | ||||||||
|
Subroutine
should_refresh: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 14 | 4 | my ($self, @args) = @_; | |||||||||
| 15 | |||||||||||
| 16 | 4 | ▶ | return 0 unless $self->SUPER::should_refresh(@args); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 3 | my $refresh_expires_time = $self->expires_time + $REFRESH_PERIOD; | |||||||||
| 19 | 3 | my $refresh_token_valid = time < $refresh_expires_time; | |||||||||
| 20 | |||||||||||
| 21 | 3 | return $refresh_token_valid; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | # These are exposed for use with /oauth/verify and /oauth/revoke API requests | ||||||||||
| 25 | 1 | ▶ | sub access_token { shift->{access_token} } | ||||||||
|
Subroutine
access_token: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | 1 | ▶ | sub refresh_token { shift->{refresh_token} } | ||||||||
|
Subroutine
refresh_token: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 27 | |||||||||||
| 28 | 2 | 1; | |||||||||
| 29 | |||||||||||
| 30 | __END__ | ||||||||||