You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: update unpkg link to pin to major versions (#1906)
* correcting links to use the right format
* updating readme to explain version pinning
* removing double @ in urls
* added details on why @2 fragment is needed
> NOTE: This link will load the highest available version of @microsoft/mgt in the range `>= 2.0.0 < 3.0.0`, omitting the `@2` fragment from the url results in loading the latest version. This could result in loading a new major version and breaking the application.
53
+
52
54
You can then start using the components in your html page. Here is a full working example with the Msal provider:
> NOTE: This link will load the highest available version of @microsoft/mgt in the range `>= 2.0.0 < 3.0.0`, omitting the `@2` fragment from the url results in loading the latest version. This could result in loading a new major version and breaking the application.
111
+
110
112
You can then start using the components in your html page. Here is a full working example with the Msal2 provider:
Copy file name to clipboardExpand all lines: samples/msal2provider-asp-net-core-sso/README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ To run the sample, you will need to create a client id and secret first and upda
36
36
37
37
## How it works
38
38
39
-
The web app is built with ASP.NET Core and users are authenticated with the [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web) package. This allows developers to authenticate users and authorize access to Web APIs (like Microsoft Graph) from the backend.
39
+
The web app is built with ASP.NET Core and users are authenticated with the [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web) package. This allows developers to authenticate users and authorize access to Web APIs (like Microsoft Graph) from the backend.
40
40
41
41
To use MGT components in the app, the client must also be able auth users and fetch tokens for Microsoft Graph. To avoid signing in the user twice just to be able to call Microsoft Graph from the client, we can leverage SSO to automatically sign in users via the current session that was established when the user signed in once.
42
42
@@ -45,7 +45,7 @@ First, we reference the toolkit and instantiate a new Msal2Provider in the **Pag
@@ -58,19 +58,19 @@ First, we reference the toolkit and instantiate a new Msal2Provider in the **Pag
58
58
}
59
59
```
60
60
61
-
To enable SSO, we need to provide a `loginHint` (the email for the current signed in user) or an `sid` (session id). This will set the provider in SSO mode which will attempt to sign in the user if they are already signed in elsewhere.
61
+
To enable SSO, we need to provide a `loginHint` (the email for the current signed in user) or an `sid` (session id). This will set the provider in SSO mode which will attempt to sign in the user if they are already signed in elsewhere.
62
62
63
63
Notice, we are also setting a redirect Uri to an empty page we created (`/sso.html`) as page for the sso process to redirect to. We've also added this page (`https://localhost/sso.html`) as a SPA redirect uri for our AAD app.
64
64
65
-
Also notice that we are not setting any scopes here. All scopes are added on the .Net side in **appsettings.json** so that the user consents once when they sign in for the first time.
65
+
Also notice that we are not setting any scopes here. All scopes are added on the .Net side in **appsettings.json** so that the user consents once when they sign in for the first time.
66
66
67
67
Finally, we are now able to use the mgt components through out our app. Here are the components being used in **Index.cshtml**:
68
68
69
69
```js
70
70
@if (User.Identity.IsAuthenticated)
71
71
{
72
72
<div>Signed in User:<mgt-person person-query="me" view="oneline"></mgt-person></div>
Copy file name to clipboardExpand all lines: samples/proxy-provider-asp-net-core/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Proxy Provider and ASP.NET Core
2
2
3
-
To use the Microsoft Graph Toolkit with backend authentication, one solution is to proxy all calls from the front end to the back end. The Microsoft Graph Toolkit ships with an authentication provider implementation (ProxyProvider) that enables all components to call the Microsoft Graph via the backend.
3
+
To use the Microsoft Graph Toolkit with backend authentication, one solution is to proxy all calls from the front end to the back end. The Microsoft Graph Toolkit ships with an authentication provider implementation (ProxyProvider) that enables all components to call the Microsoft Graph via the backend.
4
4
5
5
This sample is a reference on how to leverage the [ProxyProvider](https://learn.microsoft.com/graph/toolkit/providers/proxy) with an ASP.NET Core backend. However, it is worth noting that the ProxyProvider can work with any backend service.
6
6
@@ -9,7 +9,7 @@ This sample is a reference on how to leverage the [ProxyProvider](https://learn.
9
9
The ProxyProvider is instantiated in `Views\Shares\_Layout.cshtml`:
@@ -24,7 +24,7 @@ This code snippet also defines a login and logout functions that are used by the
24
24
25
25
## Backend code
26
26
27
-
The `/api/Proxy` endpoint that handles all calls to the Microsoft Graph is defined in `Controllers\ProxyController.cs`.
27
+
The `/api/Proxy` endpoint that handles all calls to the Microsoft Graph is defined in `Controllers\ProxyController.cs`.
28
28
29
29
This custom implementation simply proxies every method (**GET**, **POST**, **DELETE**, **PUT**, **PATCH**), and makes the actual call to the Microsoft Graph using the token generated through [MSAL.NET](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet). Notice that several headers required by the Microsoft Graph are also proxied with each request.
Copy file name to clipboardExpand all lines: samples/proxy-provider-asp-net-mvc/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Proxy Provider and ASP.NET MVC
2
2
3
-
To use the Microsoft Graph Toolkit with backend authentication, one solution is to proxy all calls from the front end to the back end. The Microsoft Graph Toolkit ships with an authentication provider implementation (ProxyProvider) that enables all components to call the Microsoft Graph via the backend.
3
+
To use the Microsoft Graph Toolkit with backend authentication, one solution is to proxy all calls from the front end to the back end. The Microsoft Graph Toolkit ships with an authentication provider implementation (ProxyProvider) that enables all components to call the Microsoft Graph via the backend.
4
4
5
5
This sample is a reference on how to leverage the [ProxyProvider](https://learn.microsoft.com/graph/toolkit/providers/proxy) with an ASP.NET MVC backend. However, it is worth nothing that the ProxyProvider can work with any backend service.
6
6
@@ -9,7 +9,7 @@ This sample is a reference on how to leverage the [ProxyProvider](https://learn.
9
9
The ProxyProvider is instantiated in `Views\Shares\_Layout.cshtml`:
@@ -24,7 +24,7 @@ This code snippet also defines a login and logout functions that are used by the
24
24
25
25
## Backend code
26
26
27
-
The `/api/GraphProxy` endpoint that handles all calls to the Microsoft Graph is defined in `Controllers\GraphProxyController.cs`.
27
+
The `/api/GraphProxy` endpoint that handles all calls to the Microsoft Graph is defined in `Controllers\GraphProxyController.cs`.
28
28
29
29
This custom implementation simply proxies every method (**GET**, **POST**, **DELETE**, **PUT**, **PATCH**), and makes the actual call to the Microsoft Graph using the token generated through the Auth2.0 On-Behalf-Of (OBO) flow. Notice that several headers required by the Microsoft Graph are also proxied with each request.
0 commit comments