nativescript-oauth icon indicating copy to clipboard operation
nativescript-oauth copied to clipboard

feat(office365): add tenant specific parameter

Open iguissouma opened this issue 7 years ago • 0 comments
trafficstars

This pull request add a tenantId value as an option for office365 oauth that can be used to control who can sign into the application. The allowed values are tenant identifiers, for example, 8eaef023-2b34-4da1-9baa-8bc8c9d6a490 or contoso.onmicrosoft.com or common for tenant-independent tokens which is the default value.

The new option can be used as below

var o365InitOptions: tnsOAuthModule.ITnsOAuthOptionsOffice365 = {
    tenantId: 'contoso.onmicrosoft.com',//specific tenant id
    clientId: '61f851ae-3b42-4ef9-8c11-xxxxxxxxxxxxx', //client id for application (GUID)
    scope: ['Files.ReadWrite', 'User.ReadWrite', 'offline_access']
};
tnsOAuthModule.initOffice365(o365InitOptions);

This will allow to use the authorizeEndpoint as https://login.microsoftonline.com/contoso.onmicrosoft.com/oauth2/v2.0/authorize and the tokenEndpoint as https://login.microsoftonline.com/contoso.onmicrosoft.com/oauth2/v2.0/token for the OAuth 2.0 authorization flow.

If no tenantId is specified the common endpoint is used by default.

Thanks for the plugin.

iguissouma avatar Apr 24 '18 18:04 iguissouma