Azure-AD-Auth
view release on metacpan or search on metacpan
lib/Azure/AD/DeviceLogin.pm view on Meta::CPAN
=head1 METHODS
=head2 access_token
Returns the access token that has to be sent to the APIs you want to access. This
is normally sent in the Authentication header of HTTPS requests as a Bearer token.
The call to access_token will start the Device Login flow, which involves transmitting
a message to the user (see message_handler attribute). The user will have to visit a
URL with a browser, insert the code in the message, authorize the application, and then
the authentication will proceed. Meanwhile the call to access_code will be blocked,
awaiting the user to complete the flow. Once the user completes the instructions the access_code
will be returned.
The access_token is cached in the object as long as it's valid, so subsequent calls
to access_token will return the appropriate token without reauthenticating to Azure AD.
If the token has expired, access_token will call Azure AD to obtain a new token.
Example usage:
my $auth = Azure::AD::DeviceLogin->new(...);
( run in 0.455 second using v1.01-cache-2.11-cpan-49f99fa48dc )