msal-svelte-dotnet
Basic use of MSAL with static Svelte frontend and Dotnet backend
Prereqs
Create an app registration in your Azure Entra ID tenant.
- Go to overview and copy the ClientId and TenantId (directory id)
- In Authentication page Add Platform and select SPA or Web app. Enter redirectUri = http://localhost:5173 (default svelte). CLICK SAVE
- Go to Expose API menu and Add Scope, leave Application ID URI and next. Use following and save
- Scope Name = Default
- choose Admin and user consent.
- enter Some Display name
- enter Some Description
You should now have a scope: api://{client_id}/Deafult
- Go to API Permissions -> Add Permission -> My Apis -> Select the app name -> Check the permission created in last step -> Add Permission
- Go to Manifest. scroll to property api:requestedAccessTokenVersion make sure this is set to 2 (integer not string). click Save
It is possible to create a separate app registration for Api. But we use one that supports login and exposes an api.