Net::Async::Spotify::Token - Representation for Spotify Token Object
use Net::Async::Spotify::Token; my $token = Net::Async::Spotify::Token->new( access_token => "NgCXRK...MzYjw", token_type => "Bearer", scope => "user-read-private user-read-email", expires_in => 3600, refresh_token => "NgAagA...Um_SHo", ); my $time_obtained = $token->updated_at->epoch; my $auth_header = $token->header_string; # Bearer NgCXRK...MzYjw my $new_token = {access_token => 'NEW...ONE',}; # can have the reset of params. $token->renew($new_token); my $new_time = $token->updated_at->epoch;
Class representing Spotify Token Object. Adds some functionality to Token object where it's easier to deal with. More details about Token itself, RFC-6749.
Spotify App User access_token
Spotify App User refresh_token
Spotify Token type, usually it's set to `Bearer` when used with Access Token. However it's also set to `Basic` when used with Authentication.
Token validity in seconds from obtained time. set in updated_at
updated_at
Spotify App User token allowed scope list https://developer.spotify.com/documentation/general/guides/scopes/
call this method while passing a new Token hash, to update the current Token Object. Accepts the same hash that you'd pass it in new().
new()
Mutator for Spotify User's Access Token, every time its set updated_at field will be set to the current time. It will return the current set Spotify Access Token.
it will return Time::Moment Object, indicating Spotify Access Token last set time.
set and get, or just get the current Spotify user's Refresh Token
set and get, or just get the Token type, default is set to `Bearer`
set and get, or just get the Token expires_in filed. Default is set to 3600 (seconds)
set and get, or just get the configured Spotify Scopes for the Token. Accepts a space space separated list of Scopes, or an Array reference of Scopes. Returns an Array reference of Spotify Scopes set to Token. https://developer.spotify.com/documentation/general/guides/scopes/
Returns a String, containing the Token type and the Access Token, space separated. Needed for Authorization header.
To install Net::Async::Spotify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Spotify
CPAN shell
perl -MCPAN -e shell install Net::Async::Spotify
For more information on module installation, please visit the detailed CPAN module installation guide.