| 1 | package CatalystX::OAuth2::Request::RefreshToken; | ||||||||||
| 2 | 10 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 10 | ▶ | use URI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 10 | with 'CatalystX::OAuth2'; | |||||||||
| 5 | |||||||||||
| 6 | # ABSTRACT: The oauth2 refresh token | ||||||||||
| 7 | |||||||||||
| 8 | 10 | has grant_type => ( is => 'ro', required => 1 ); | |||||||||
| 9 | 10 | has refresh_token => ( is => 'ro' ); | |||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | around _params => sub { shift->(@_), qw(grant_type refresh_token) }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | sub _build_query_parameters { | ||||||||||
| 14 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_build_query_parameters: called CC=3 SCAR=11.4
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | my $code = $self->store->find_code_from_refresh( $self->refresh_token ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | or return { | ||||||||||
| 18 | error => 'invalid_grant', | ||||||||||
| 19 | error_description => 'The provided authorization grant ' | ||||||||||
| 20 | . 'is invalid, expired, revoked, does not match the ' | ||||||||||
| 21 | . 'redirection URI used in the authorization request, ' | ||||||||||
| 22 | . 'or was issued to another client.' | ||||||||||
| 23 | }; | ||||||||||
| 24 | |||||||||||
| 25 | 1 | ▶ | my $token = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | $self->store->create_access_token_from_refresh( $self->refresh_token ) | ||||||||||
| 27 | or return { error => 'internal_error' }; | ||||||||||
| 28 | return { | ||||||||||
| 29 | 1 | access_token => $token->as_string, | |||||||||
| 30 | token_type => $token->type, | ||||||||||
| 31 | expires_in => $token->expires_in | ||||||||||
| 32 | }; | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 10 | 1; | |||||||||
| 36 | |||||||||||
| 37 | __END__ | ||||||||||
| 38 | |||||||||||
| 39 | =pod | ||||||||||
| 40 | |||||||||||
| 41 | =head1 NAME | ||||||||||
| 42 | |||||||||||
| 43 | CatalystX::OAuth2::Request::RefreshToken - The oauth2 refresh token | ||||||||||
| 44 | |||||||||||
| 45 | =head1 VERSION | ||||||||||
| 46 | |||||||||||
| 47 | version 0.001006 | ||||||||||
| 48 | |||||||||||
| 49 | =head1 AUTHOR | ||||||||||
| 50 | |||||||||||
| 51 | Eden Cardim <edencardim@gmail.com> | ||||||||||
| 52 | |||||||||||
| 53 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 54 | |||||||||||
| 55 | This software is copyright (c) 2017 by Suretec Systems Ltd. | ||||||||||
| 56 | |||||||||||
| 57 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 58 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 59 | |||||||||||
| 60 | =cut | ||||||||||