Using JSON Web Tokens (JWT) with Azure Functions (WITHOUT using Active Directory)

后端 未结 5 1889
渐次进展
渐次进展 2021-01-31 21:04

I am sure someone out there has already done this, but I have yet to find any documentation with regard to the Microsoft implementation of JWT. The official documentation from

5条回答
  •  北海茫月
    2021-01-31 21:30

    Try this: https://liftcodeplay.com/2017/11/25/validating-auth0-jwt-tokens-in-azure-functions-aka-how-to-use-auth0-with-azure-functions/ I successfully made it work using this guide. It took awhile due to nuget versions.

    Follow that guide properly and use the following nuget versions

    IdentityModel.Protocols (2.1.4)
    IdentityModel.Protocols.OpenIdConenct (2.1.4)
    IdentityModel.Tokens.Jwt (5.1.4)
    

    Oh and, the guide tells you to write your AUDIENCE as your api link, don't. You'll get unauthorized error. Just write the name of your api, e.g. myapi

    If you get error about System.http.formatting not being loaded when running the function, try to reinstall NET.Sdk.Functions and ignore the warning about AspNet.WebApi.Client being restored using .NETFramework. And restart visual studio.

提交回复
热议问题