Skip to content

Commit

Permalink
add notice on graph sdk v3
Browse files Browse the repository at this point in the history
  • Loading branch information
derisen committed Sep 5, 2021
1 parent 2e551e3 commit a78835f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions 2-Authorization-I/1-call-graph/App/graph.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/**
* The code below demonstrates how you can use MSAL as a custom authentication provider for the Microsoft Graph JavaScript SDK.
* You do NOT need to implement a custom provider. Microsoft Graph JavaScript SDK v3.0 (preview) offers AuthCodeMSALBrowserAuthenticationProvider
* which handles token acquisition and renewal for you automatically. For more information on how to use it, visit:
* https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/AuthCodeMSALBrowserAuthenticationProvider.md
*/

/**
* Returns a graph client object with the provided token acquisition options
* @param {Object} account: user account object to be used when attempting silent token acquisition
* @param {Array} scopes: array of scopes required for this resource endpoint
* @param {string} interactionType: type of interaction to fallback to when silent token acquisition fails
* @param {Object} providerOptions: object containing user account, required scopes and interaction type
*/
const getGraphClient = (providerOptions) => {

Expand All @@ -20,14 +25,14 @@ const getGraphClient = (providerOptions) => {
}

/**
* This class implements the IAuthenticationProvider interface, which allows a custom auth provider to be
* This class implements the IAuthenticationProvider interface, which allows a custom authentication provider to be
* used with the Graph client. See: https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/src/IAuthenticationProvider.ts
*/
class MsalAuthenticationProvider {

account;
scopes;
interactionType;
account; // user account object to be used when attempting silent token acquisition
scopes; // array of scopes required for this resource endpoint
interactionType; // type of interaction to fallback to when silent token acquisition fails

constructor(providerOptions) {
this.account = providerOptions.account;
Expand Down
2 changes: 1 addition & 1 deletion 2-Authorization-I/1-call-graph/App/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if (typeof Msal === 'undefined') document.write(unescape("%3Cscript src='https://alcdn.msftauth.net/browser/2.15.0/js/msal-browser.js' type='text/javascript' crossorigin='anonymous' %3E%3C/script%3E"));
</script>

<!-- adding Graph SDK via CDN-->
<!-- adding Graph SDK v2.0 via CDN-->
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/@microsoft/microsoft-graph-client/lib/graph-js-sdk.js"></script>

Expand Down

0 comments on commit a78835f

Please sign in to comment.