Mojo-JWT-Google

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
And add any attribute defined in this class. The JWT is fairly useless
unless you define your scopes.
 
 my $gjwt = Mojo::JWT::Google->new(secret => 's3cr3t',
                                   scopes => [ '/my/scope/a', '/my/scope/b' ],
                                   client_email => 'riche@cpan.org')->encode;
 
You can also get your information automatically from the .json you
received from Google. Your secret key is in that file, so it's best to
keep it safe somewhere. This will ease some busy work in configuring the
object -- with virtually the only things to do is determine the scopes
and the user_as if you need to impersonate.
 
  my $gjwt = Mojo::JWT::Google
    ->new( from_json => '/my/secret.json',
           scopes    => [ '/my/scope/a', '/my/scope/b' ])->encode;
 
To authenticate, send a post request to
Mojo::JWT::Google's as_form_data method as the payload.

lib/Mojo/JWT/Google.pm  view on Meta::CPAN

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
And add any attribute defined in this class.  The JWT is fairly useless unless
you define your scopes.
 
 my $gjwt = Mojo::JWT::Google->new(secret => 's3cr3t',
                                   scopes => [ '/my/scope/a', '/my/scope/b' ],
                                   client_email => 'riche@cpan.org')->encode;
 
You can also get your information automatically from the .json you received
from Google.  Your secret key is in that file, so it's best to keep it safe
somewhere.  This will ease some busy work in configuring the object -- with
virtually the only things to do is determine the scopes and the user_as if you
need to impersonate.
 
  my $gjwt = Mojo::JWT::Google
    ->new( from_json => '/my/secret.json',
           scopes    => [ '/my/scope/a', '/my/scope/b' ])->encode;
 
 
To authenticate, send a post request to https://www.googleapis.com/oauth2/v4/token,
with your Mojo::JWT::Google's as_form_data method as the payload.



( run in 0.423 second using v1.01-cache-2.11-cpan-454fe037f31 )