blib/lib/LWP/Authen/OAuth2/ServiceProvider/Withings.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 48 SCAR 6.9
CC
1
Cov
0%
authorization_endpoint
2.0
token_endpoint
2.0
authorization_required_params
2.0
CRAP 2.0
1 package LWP::Authen::OAuth2::ServiceProvider::Withings;
2  
3 # ABSTRACT: Withings OAuth2
4 our $VERSION = '0.18'; our $VERSION = '0.19'; # VERSION
5  
6 use strict;
7 use warnings;
8 use JSON;
9  
10 our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider);
11  
12 sub authorization_endpoint {
13 return ' https://account.withings.com/oauth2_user/authorize2';
14 }
15  
16 sub token_endpoint {
17 return 'https://wbsapi.withings.net/v2/oauth2';
18 }
19  
20 sub authorization_required_params {
21 return ( 'client_id', 'state', 'scope', 'redirect_uri', 'response_type' );
22 }
23  
24 sub authorization_default_params {
25 return ( response_type => 'code', state => 'auth', scope => 'user.metrics' );
26 }
27  
28 sub request_required_params {
29 return ( 'action', 'grant_type', 'client_id', 'client_secret', 'code', 'redirect_uri' );
30 }
31  
32 sub request_default_params {
33 return ( grant_type => 'authorization_code', action => 'requesttoken' );
34 }
35  
36 sub refresh_required_params {
37 return ( 'action', 'grant_type', 'client_id', 'client_secret', 'refresh_token' );
38 }
39  
40 sub refresh_default_params {
41 return ( grant_type => 'refresh_token', action => 'requesttoken' );
42 }
43  
44 sub construct_tokens {
45 my ( $self, $oauth2, $response ) = @_;
46  
47 my $content = eval { decode_json( $response->content ) };
48 $content = $content->{ 'body' };
49 $response->content( encode_json( $content ) );
50  
51 $self->SUPER::construct_tokens( $oauth2, $response );
52 }
53  
54 1;
55  
56 __END__