blib/lib/Mojolicious/Plugin/Web/Auth/Site/LinkedIn.pm

filter: Statementstmt 95.0% 19 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 88.0% 22 / 25 CC 1 SCAR 2.2
CC
1
Cov
95%
moniker
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Mojolicious::Plugin::Web::Auth::Site::LinkedIn;
5 1 $Mojolicious::Plugin::Web::Auth::Site::LinkedIn::VERSION = '0.05';
6 1 ▶use Mojo::Base qw/Mojolicious::Plugin::Web::Auth::OAuth2/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 has access_token_url => 'https://www.linkedin.com/oauth/v2/accessToken';
9 1 has authorize_url => 'https://www.linkedin.com/oauth/v2/authorization';
10 1 has response_type => 'code';
11 1 has scope => 'r_liteprofile r_emailaddress';
12 1 has user_info => 1;
13 1 has user_info_url => 'https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))';
14 1 has user_more_info_url => 'https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))';
15 1 has authorize_header => 'Bearer';
16  
17 0 ▶sub moniker {'linkedin'}
Subroutine moniker: not called CC=1 SCAR=6.9
Pod undocumented
18  
19 1 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<LinkedIn|https://developer.linkedin.com/docs/rest-api/> support to
67 L<Mojolicious::Plugin::Web::Auth>.
68  
69 The only extra URL option is the C<user_more_info_url> which the user can use to do a L<Mojo::UserAgent> 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<LinkedIn API|https://developer.linkedin.com/docs/rest-api/>.
70  
71 =head1 AUTHOR
72  
73 Vikas N Kumar <vikas@cpan.org>
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__
↑ Summary