I'm using appcenter Auth and Data in my Xamarin forms Application, but microsoft are shutting down these services so i now need to do it myself. Atm these two allowed me to verify my users with ADB2C and then grant them to access there own and shared content in the Cosmos Database.
What i have atm: I can log in via MSAL to my AD B2C. I can access my DB with Microsoft.Azure.DocumentDB.Core.
What i need is: I need to be able to generate Ressource Token and configure the Database so only the User can access their documents.(Only found outdated and poorly described Tutorials)
Or as an alternative: How is it possible to create Azure functions that only User which are logged in via msal can call? And then i would need the user id in the Azure function to check against the db.(All the Tutorials handle the user verification on the api call, this is not possible when calling from application)
You cannot use the AAD B2C issued user token to access Cosmos DB resource.
Try this link - you will need to pass the B2C token to a AAD B2C protected API which then makes the API call on behalf of the user using client_credentials (AAD service account).
https://codemilltech.com/adding-azure-ad-b2c-authentication-to-azure-functions/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With