NAME

OAuth::Lite::Token - token class

SYNOPSIS

my $token = OAuth::Lite::Token->new(
    token  => 'foo',
    secret => 'bar',
);

# or
my $token = OAuth::Lite::Token->new;
$tokne->token('foo');
$secret->secret('bar');

# and you also can make token which two params are filled in with random values.
my $token = OAuth::Lite::Token->new_random;
say $token->token;
say $token->secret;

my $encoded = $token->as_encoded;
say $encoded;

my $new_token = OAuth::Lite::Token->from_encoded($encoded);
say $new_token->token;
say $new_token->secret;

DESCRIPTION

Token class.

METHODS

new

parameters

token
secret

new_random

Generate new object. and automatically filled token and secret value with random key.

my $t = OAuth::Lite::Token->new_random;
say $t->token;
say $t->secret;

token($token_value)

Getter/Setter for token value.

$token->token('foo');
say $token->token;

secret($token_secret)

Getter/Setter for secret value.

$token->secret('bar');
say $token->secret;

from_encoded($encoded)

Generate token from encoded line (that service provider provides as response of request token.).

my $line = "oauth_token=foo&oauth_token_secret=bar";
my $token = OAuth::Lite::Token->from_encoded($encoded);
say $token->token;
say $token->secret;

as_encoded

Returns encoded line from token object.

my $token = OAuth::Lite::Token->new(
    token  => 'foo',
    secret => 'bar',
);
say $token->as_encoded; #oauth_token=foo&oauth_token_secret=bar

AUTHOR

Lyo Kato, lyo.kato _at_ gmail.com

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.