File Coverage

blib/lib/Mojolicious/Plugin/Web/Auth/Site/LinkedIn.pm
Criterion Covered Total %
statement 9 10 90.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 15 80.0


line stmt bran cond sub pod time code
1 1     1   773 use strict;
  1         3  
  1         46  
2 1     1   6 use warnings;
  1         2  
  1         60  
3              
4             package Mojolicious::Plugin::Web::Auth::Site::LinkedIn;
5             $Mojolicious::Plugin::Web::Auth::Site::LinkedIn::VERSION = '0.05';
6 1     1   532 use Mojo::Base qw/Mojolicious::Plugin::Web::Auth::OAuth2/;
  1         203249  
  1         7  
7              
8             has access_token_url => 'https://www.linkedin.com/oauth/v2/accessToken';
9             has authorize_url => 'https://www.linkedin.com/oauth/v2/authorization';
10             has response_type => 'code';
11             has scope => 'r_liteprofile r_emailaddress';
12             has user_info => 1;
13             has user_info_url => 'https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))';
14             has user_more_info_url => 'https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))';
15             has authorize_header => 'Bearer';
16              
17 0     0 0   sub moniker {'linkedin'}
18              
19             1;
20              
21             =pod
22              
23             =encoding UTF-8
24              
25             =head1 NAME
26              
27             Mojolicious::Plugin::Web::Auth::Site::LinkedIn - LinkedIn OAuth Plugin for Mojolicious::Plugin::Web::Auth
28              
29             =head1 VERSION
30              
31             version 0.05
32              
33             =head1 SYNOPSIS
34              
35             # Mojolicious
36             $self->plugin('Web::Auth',
37             module => 'LinkedIn',
38             key => 'LinkedIn consumer key',
39             secret => 'LinkedIn consumer secret',
40             on_finished => sub {
41             my ( $c, $access_token, $email_info ) = @_;
42             ...
43             },
44             on_error => sub {
45             my ( $c, $error ) = @_;
46             ...
47             },
48             );
49              
50             # Mojolicious::Lite
51             plugin 'Web::Auth',
52             module => 'LinkedIn',
53             key => 'LinkedIn consumer key',
54             secret => 'LinkedIn consumer secret',
55             on_finished => sub {
56             my ( $c, $access_token, $email_info ) = @_;
57             ...
58             };
59              
60              
61             # default authentication endpoint: /auth/linkedin/authenticate
62             # default callback endpoint: /auth/linkedin/callback
63              
64             =head1 DESCRIPTION
65              
66             This module adds L support to
67             L.
68              
69             The only extra URL option is the C which the user can use to do a L call to with the access token as a parameter, to get the other info such as profile image and first or last name. This URL can also be modified by the user to retrieve extra fields. For more details refer to the L.
70              
71             =head1 AUTHOR
72              
73             Vikas N Kumar
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2019 by Vikas N Kumar.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut
83              
84             __END__