Public preview: Customize Azure Static Web Apps authentication with a serverless function
Published date: 13 October, 2021
You can now define a serverless function that is invoked whenever a user successfully logs in to your static web app. This function can assign custom roles to the logged in user. You can use these roles to configure route-based authorization rules; and other serverless functions in your app can also access these roles.
This feature provides flexibility in how users are assigned custom roles in your application. Some scenarios this enables include:
Assign custom roles to more than the 25 users supported by the existing built-in invitation system
Query a database to determine which custom roles a user should be assigned
Call the Microsoft Graph API to determine a user’s roles based on their Active Directory group membership
Use claims from the identity provider to determine a user’s roles
Learn more about this new feature in the Azure Static Web Apps documentation.