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
This quickstart walks you through how to create a BFF Blazor application. The sourcecode for this quickstart is available on [GitHub](https://github.com/DuendeSoftware/Samples/tree/main/BFF/v3/Quickstarts/BlazorBffApp)
18
20
@@ -27,11 +29,11 @@ cd BlazorBffApp
27
29
dotnet new blazor --interactivity auto --all-interactive
28
30
```
29
31
30
-
This creates a blazor application with a Server project and a client project.
32
+
This creates a blazor application with a Server project and a client project.
31
33
32
34
## Configuring the BffApp server project
33
35
34
-
To configure the server, the first step is to add the BFF Blazor package.
36
+
To configure the server, the first step is to add the BFF Blazor package.
To configure the web app pipeline. Replace the app.UseAntiforgery() with the code below:
96
153
97
154
```csharp
@@ -127,16 +184,16 @@ builder.Services
127
184
.AddCascadingAuthenticationState();
128
185
```
129
186
130
-
Your application is ready to use BFF now.
187
+
Your application is ready to use BFF now.
131
188
132
189
## Configuring your application to use bff's features
133
190
134
191
Add the following components to your BlazorBffApp.Client's Component folder:
135
192
136
193
### LoginDisplay.razor
137
194
138
-
The following code shows a login / logout button depending on your state. Note, you'll need to use the
139
-
logout link from the LogoutUrl claim, because this contains both the correct route and the session id.
195
+
The following code shows a login / logout button depending on your state. Note, you'll need to use the
196
+
logout link from the LogoutUrl claim, because this contains both the correct route and the session id.
140
197
Add it to the BffBlazorApp.Client/Components folder
141
198
142
199
```csharp
@@ -217,7 +274,7 @@ Replace the contents of routes.razor so it matches below:
217
274
</Router>
218
275
```
219
276
220
-
Thismakessurethat, ifyou're accessing a page that requires authorization, that you are automatically redirected to Identity Server for authentication.
277
+
Thismakessurethat, ifyou're accessing a page that requires authorization, that you are automatically redirected to Identity Server for authentication.
221
278
222
279
### Modifications to MainLayout.razor
223
280
@@ -250,16 +307,16 @@ Modify your MainLayout so it matches below:
250
307
</div>
251
308
```
252
309
253
-
This adds the LoginDisplay to the header.
310
+
This adds the LoginDisplay to the header.
254
311
255
-
Now your application supports logging in / out.
312
+
Now your application supports logging in / out.
256
313
257
314
## Exposing APIs
258
315
259
-
Now we're going to expose a local api for weather forecasts to Blazor wasm and call it via a HttpClient.
316
+
Now we're going to expose a local api for weather forecasts to Blazor wasm and call it via a HttpClient.
260
317
261
318
> By default, the system will perform both pre-rendering on the server AND WASM based rendering on the client. For this reason, you'll need to register both a server and client version of a component that retrieves data.
262
-
> See the [Microsoft documentation](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-9.0#client-side-services-fail-to-resolve-during-prerendering) for more information on this.
319
+
> See the [Microsoft documentation](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/render-modes?view=aspnetcore-9.0#client-side-services-fail-to-resolve-during-prerendering) for more information on this.
263
320
264
321
### Configuring the Client app
265
322
@@ -280,20 +337,20 @@ public class WeatherForecast
0 commit comments