Skip to content

Commit

Permalink
Updating PR
Browse files Browse the repository at this point in the history
Updating missing update in docs
Adjusting serve\main.ts debugging sample.
  • Loading branch information
bcameron1231 committed Dec 19, 2023
1 parent 6587ba4 commit 0ff5994
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions debug/serve/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MSAL } from "@pnp/msaljsclient/index.js";
import { MSAL, MSALOptions } from "@pnp/msaljsclient/index.js";
import { spfi, SPBrowser } from "@pnp/sp";
import "@pnp/sp/webs";
import { settings } from "../../settings.js";
Expand Down Expand Up @@ -31,8 +31,8 @@ document.onreadystatechange = async () => {
// Make sure to add `https://localhost:8080/spa.html` as a Redirect URI in your testing's AAD App Registration
const sp = spfi().using(
SPBrowser({ baseUrl: settings.testing.sp.url}),
MSAL(settings.testing.sp.msal.init, {scopes: settings.testing.sp.msal.scopes})
);
MSAL({configuration:settings.testing.sp.msal.init, authParams: {scopes: settings.testing.sp.msal.scopes}})
);

const r = await sp.web();

Expand Down
25 changes: 13 additions & 12 deletions docs/concepts/auth-spfx.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,26 @@ Each of the following samples reference a MSAL configuration that utilizes an Az
```TypeScript
import { SPFx as graphSPFx, graphfi } from "@pnp/graph";
import { SPFx as spSPFx, spfi } from "@pnp/sp";
import { MSAL } from "@pnp/msaljsclient";
import { Configuration, AuthenticationParameters } from "msal";
import { MSAL, MSALOptions } from "@pnp/msaljsclient";

import "@pnp/graph/users";
import "@pnp/sp/webs";

const configuration: Configuration = {
auth: {
authority: "https://login.microsoftonline.com/{tenant Id}/",
clientId: "{AAD Application Id/Client Id}"
const configuration: MSALOptions = {
configuration:{
auth: {
authority: "https://login.microsoftonline.com/{tenant Id}/",
clientId: "{AAD Application Id/Client Id}"
},
},
authParams: {
scopes: ["https://graph.microsoft.com/.default"]
}
};

const authParams: AuthenticationParameters = {
scopes: ["https://graph.microsoft.com/.default"]
};

// within a webpart, application customizer, or adaptive card extension where the context object is available
const graph = graphfi().using(graphSPFx(this.context), MSAL(configuration, authParams));
const sp = spfi().using(spSPFx(this.context), MSAL(configuration, authParams));
const graph = graphfi().using(graphSPFx(this.context), MSAL(configuration));
const sp = spfi().using(spSPFx(this.context), MSAL(configuration));

const meData = await graph.me();
const webData = await sp.web();
Expand Down

0 comments on commit 0ff5994

Please sign in to comment.