Build with an Azure free account. Get USD200 credit for 30 days and 12 months of free services.

Start free today

Using resource tokens with Azure Cosmos DB

Sign in to queue

The Discussion

  • User profile image
    Thomas Levesque

    The JWT is never validated. Anyone can generate a dummy JWT, and it will be accepted and exchanged for a valid CosmosDB resource token.

  • User profile image
    crandycodes

    @Thomas Levesque: App Service's Authentication / Authorization (aka Easy Auth) feature does the Authentication/Verification of that JWT for us, so we don't need to manage the complexity of correctly verifying the JWT.

    Easy Auth prevents spoofing of that header when it is turned on. If you don't turn it on, then yes you can spoof that JWT. Make sure you have Easy Auth turned on and you don't have to worry. You can add the verify logic for the JWT in there if you want to protect against Easy Auth being turned off accidentally, but it's not necessary otherwise.

  • User profile image
    Niner810749

    Wouldn't be easier and just as fast to just to create an Azure Functions Web Api, secured by EasyAuth (Azure AD B2C)? Then you could place this in front of each region you deploy the cosmos db?  Do you have any demo's of this scenario?   

       

  • User profile image
    Jefferson

    This approach is sufficient secure for Payment Gateway (Xamarin) app client?

  • User profile image
    crandycodes

    @Niner810749: You could certainly do that, and that's often the best approach. This model is valuable if you need to provide direct access to Cosmos DB, but need to lock down the permissions you grant.

    The token provider sample listed in the description is the main sample we have. We don't currently have any other video content demoing it.

  • User profile image
    crandycodes

    @Jefferson: I can't speak to the payments gateway part, but this is sufficient to grant controlled access to mobile users.

Add Your 2 Cents