Net-OAuth2
view release on metacpan or search on metacpan
lib/Net/OAuth2/AccessToken.pod view on Meta::CPAN
=over 4
=item $obj-E<gt>B<error>()
=item $obj-E<gt>B<error_description>()
=item $obj-E<gt>B<error_uri>()
=back
=head3 Expiration
=over 4
=item $obj-E<gt>B<auto_refresh>()
=item $obj-E<gt>B<expired>( [$after] )
Returns true when the token has an expiration set and that time has
passed. We use this token $after this check: to avoid the token to
timeout inbetween, we take (by default 15 seconds) margin.
=item $obj-E<gt>B<expires_at>( [$timestamp] )
Returns the expiration timestamp of this token (true) or C<undef> (false)
when it is not set.
=item $obj-E<gt>B<expires_in>()
Returns the number of seconds left, before the token is expired. That
may be negative.
=item $obj-E<gt>B<refresh_always>()
=item $obj-E<gt>B<refresh_token>()
=item $obj-E<gt>B<update_token>( $token, $tokentype, $expires_at, [$refresh_token] )
Change the token.
=back
=head2 Actions
=over 4
=item $obj-E<gt>B<refresh>()
Refresh the token, even if it has not expired yet. Returned is the
new access_token value, which may be undef on failure.
=item $obj-E<gt>B<session_freeze>(%options)
This returns a SESSION (a flat HASH) containing all token parameters which
needs to be saved to be able to restore this token later. This SESSION
can be passed to L<session_thaw()|Net::OAuth2::AccessToken/"Constructors"> to get revived.
The C<changed> flag will be cleared by this method.
Be sure that your storage is character-set aware. For instance, you
probably want to set 'mysql_enable_utf8' when you store this in a
MySQL database. Perl's JSON module will output utf8 by default.
=item $obj-E<gt>B<to_json>()
Freeze this object into JSON. The JSON syntax is also used by the OAuth2
protocol, so a logical choice to provide. However, generically, the
L<session_freeze()|Net::OAuth2::AccessToken/"Actions"> method provided.
=back
=head3 HTTP
The token can be encoded in transport protocol in different ways. Using
these method will add the token to the HTTP messages sent.
=over 4
=item $obj-E<gt>B<delete>( $uri, [$header, [$content]] )
=item $obj-E<gt>B<get>( $uri, [$header, [$content]] )
=item $obj-E<gt>B<post>( $uri, [$header, [$content]] )
=item $obj-E<gt>B<put>( $uri, [$header, [$content]] )
=item $obj-E<gt>B<request>($request)
=back
=head1 COPYRIGHTS
Copyrights 2013-2019 on the perl code and the related documentation
by [Mark Overmeer <markov@cpan.org>] for SURFnet bv, The Netherlands. For other contributors see L</Changes>.
Copyrights 2011-2012 by Keith Grennan.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://dev.perl.org/licenses/>
( run in 0.586 second using v1.01-cache-2.11-cpan-e93a5daba3e )