Microsoft Account

General plugins (Local) ::: local_msaccount
Maintained by Enovation Dev Team, James McQuillan, Zion Brewer, Nima Mojgani
Part of set Microsoft Services.
This plugin provides a simple client API for OAuth2-based authentication and token management for Microsoft Account. It also provides some helper functions for making REST API calls to services that use the Microsoft Account.
Latest release:
115 sites
9 downloads
13 fans
Current versions available: 5

Note: official support for this plugin has stopped

Moodle plugins for Microsoft Services

including Office 365 and other Microsoft services


Microsoft Account API Local Plugin

This plugin provides a simple client API for OAuth2-based authentication and token management for Microsoft Account. It also provides some helper functions for making REST API calls to services that use the Microsoft Account.


Usage

Instantiation:

    $msaccountapi = msaccount_api::getinstance();

Logging the user in:

        $msaccount_api->is_logged_in();

Making a REST API call:

        $response = $msaccount_api->myget($url);


Design details

There are several parts that make up the Microsoft Account API plugin.


Configuration

This allows an administrator to specify OAuth2 settings such as client id and secret for the Microsoft Account application associated with this Moodle installation.

msaccount_api class

This is a singleton class that provides simple wrappers for various methods provided by the msaccount_client class. Please use this class for accessing all the functionality provided by the msaccount_client class.

msaccount_client class

Note: Please do not use this class directly. Instead, use the msaccount_api class described above.


This class is derived from Moodle's oauth2_client class and:

  • Adds support for retrieving and saving refresh tokens and logging in using the refresh token if the main token expires.
  • This also becomes useful for automated unit testing because we can use the refresh tokens to log users in automatically.
  • Works around an issue in the oauth2_client where it sets the token in the header only if it thinks that it is making a post request, but the Microsoft Account REST API needs auth token in the header for get as well as post requests.


This is part of the suite of Microsoft Services plugins for Moodle.

This plugin is updated with stable releases. To follow active development, see: https://github.com/Microsoft/o365-moodle


Contributing

Before we can accept your pull request, you'll need to electronically complete Microsoft's Contributor License Agreement. If you've done this for other Microsoft projects, then you're already covered.

Why a CLA? (from the FSF)


Copyright

(c) Microsoft, Inc.  Code for this plugin is licensed under the GPLv3 license.

Any Microsoft trademarks and logos included in these plugins are property of Microsoft and should not be reused, redistributed, modified, repurposed, or otherwise altered or used outside of this plugin.

Screenshots

Screenshot #0

Contributors

Enovation Dev Team (Lead maintainer)
Vinayak (Vin) Bhalerao
Akinsaya Delamarre
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Anthony Borrow
    Sun, 18 Jan 2015, 3:08 AM
    James - Many thanks for sharing this plugin with the Moodle community. I am in the process of reviewing it and the other related plugins. I was able to install the plugin without issue and will continue the review. Peace - Anthony
  • Henrik sune Pedersen
    Wed, 20 Jan 2016, 9:36 PM
    I had some problems installing this plugin after upgrading from moodle 2.8.2 to 2.9.4
    I got an error : Can't use function return value in write context in moodle/local/msaccount/classes/client.php on line 62

    I solved it by doing this at the function that made the error at line 62:

    public static function is_configured() {
    $get_client_id = get_config('local_msaccount', 'clientid'); // New code
    $get_client_secret = get_config('local_msaccount', 'clientsecret'); // New code
    if ( $get_client_id == '' || $get_client_secret == '') {
    return false;
    }
    return true;
    }

    I hope you can confirm the error and the solution smile

    Kind regards

    Henrik Sune Pedersen
  • James McQuillan
    Sat, 23 Jan 2016, 3:23 AM
    Thanks for the report - I can confirm the issue. I have added a task to get this fixed as soon as possible.
  • Thomas College
    Thu, 2 Feb 2017, 10:26 PM
    Sorry as I'm not clear on this, but will this plugin work with Office365 / work and school accounts to provide OneNote for work and school account integration?
  • James McQuillan
    Fri, 3 Feb 2017, 4:27 AM
    @thomas college - This plugin provides basic support for the free "Microsoft account". If you have Office 365 for work/school accounts, please look at https://moodle.org/plugins/local_office365 instead.
  • InsightKorea JobS
    Thu, 9 Nov 2017, 3:21 PM
    Hello~ Is possible in 3.3? I couldn't setup this plugin. MS client password was not activating. What should I do?
Please login to post comments