Created
March 8, 2015 16:46
-
-
Save andrewconnell/a5d19e703cdcd8b58d13 to your computer and use it in GitHub Desktop.
ADAL JS + Angular: Initializing the ADAL provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module adalO365CorsClient { | |
'use strict'; | |
export class Adal { | |
/** | |
* Configures ADAL JS with required info for the registered app in Azure AD. | |
* | |
* @param $httpProvider Angular's $httpProvider (needed by ADAL) | |
* @param adalSettings Settings for ADAL | |
* @param adalProvider ADAL JS' Angular provider. | |
*/ | |
static configure($httpProvider:ng.IHttpProvider, | |
adalSettings:shared.IAdalSettings, | |
adalProvider:any):void { | |
// init the ADAL service | |
adalProvider.init({ | |
tenant: '7d8ba536-3406-4865-8884-be9a5b3802ec', | |
clientId: 'b2bb3c28-a7be-4f3b-a2b5-f11c9d808953', | |
postLogoutRedirectUri: 'http://localhost:8000', | |
endpoints: { | |
/* 'target endpoint to be called': 'target endpoint's resource ID' */ | |
// sharepoint site containing lists | |
'https://[your-tenant-here].sharepoint.com/_api/': 'https://[your-tenant-here].sharepoint.com', | |
// o365 files api | |
'https://[your-tenant-here]-my.sharepoint.com/_api/v1.0/me': 'https://[your-tenant-here]-my.sharepoint.com/' | |
} | |
}, $httpProvider); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks you for your example @andrewconnell 👍
Just for your information you can place the tenant name rather than your tenantId in configuration adalProvider :
And URL is more beautiful for the users during the authentication