| 1 | ########################################### | ||
| 2 | package OAuth::Cmdline::MicrosoftOnline; | ||
| 3 | ########################################### | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use MIME::Base64; | ||
| 7 | use base qw( OAuth::Cmdline ); | ||
| 8 | |||
| 9 | ########################################### | ||
| 10 | sub site { | ||
| 11 | ########################################### | ||
| 12 | return "microsoft-online"; | ||
| 13 | } | ||
| 14 | |||
| 15 | 1; | ||
| 16 | |||
| 17 | __END__ | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | OAuth::Cmdline::MicrosoftOnline - Microsoft Online-specific settings for OAuth::Cmdline | ||
| 22 | |||
| 23 | =head1 SYNOPSIS | ||
| 24 | |||
| 25 | my $oauth = OAuth::Cmdline::MicrosoftOnline->new( ); | ||
| 26 | $oauth->access_token(); | ||
| 27 | |||
| 28 | =head1 DESCRIPTION | ||
| 29 | |||
| 30 | This class overrides methods of C<OAuth::Cmdline> if Microsoft Online's Web API | ||
| 31 | requires it. | ||
| 32 | |||
| 33 | To use this module with Azure AD: | ||
| 34 | |||
| 35 | =over | ||
| 36 | |||
| 37 | =item * | ||
| 38 | Set up a temporary web service for callbacks as described in C<OAuth::Cmdline> and as in eg/microsoft-online-token-init | ||
| 39 | |||
| 40 | =item * | ||
| 41 | Sign up for Azure AD for your Office 365 (free). | ||
| 42 | |||
| 43 | =item * | ||
| 44 | Add an Azure AD app of type Web, with callbacks pointing to your temporary web service | ||
| 45 | |||
| 46 | =item * | ||
| 47 | Retrieve the ID and key (secret) from the app page | ||
| 48 | |||
| 49 | =item * | ||
| 50 | Update your web service with the ID and secret and start it | ||
| 51 | |||
| 52 | =item * | ||
| 53 | Go to your web service and follow the link | ||
| 54 | |||
| 55 | =item * | ||
| 56 | Authenticate to O365 | ||
| 57 | |||
| 58 | =back | ||
| 59 | |||
| 60 | Your web service will retrieve the tokens and store them. You can then use | ||
| 61 | |||
| 62 | $oauth->access_token() | ||
| 63 | |||
| 64 | to get an access token to carry out calls against the Azure Graph API as shown in eg/microsoft-online-users. Remember the token is tied to the user account - if the user account is removed or disabled, the calls will stop working. | ||
| 65 | |||
| 66 | Example code is in the eg folder | ||
| 67 | |||
| 68 | =head1 LEGALESE | ||
| 69 | |||
| 70 | Copyright 2015 Mike Schilli, all rights reserved. | ||
| 71 | This program is free software, you can redistribute it and/or | ||
| 72 | modify it under the same terms as Perl itself. | ||
| 73 | |||
| 74 | =head1 AUTHOR | ||
| 75 | |||
| 76 | 2015, Ian Gibbs |