CharlieDigital / AzFunctionsJwtAuth

Skeleton code for performing authentication and authorization with custom schemes and JWT in Azure Functions
MIT License
14 stars 4 forks source link

custom authentication in node js and javascript #1

Open anishkarthick opened 2 years ago

anishkarthick commented 2 years ago

Is it possible to authenticate azure function endpoints with custom authentication in node js javascript as you done here with c# can uyou provide me a solution.. Thanks in advance..

CharlieDigital commented 2 years ago

anish, for Node.js, it's simply a matter of using a JWT package from NPM instead.

Try this package: https://www.npmjs.com/package/jose

With examples:

anishkarthick commented 2 years ago

thaks a lot bt my problem is am new to azure and azure functions .. I have used jwt as midleware with express in node and its totally different with az func will it work??

CharlieDigital commented 2 years ago

Anish, you won't be able to use middleware, but in this case, you simply need to write an unauthenticated endpoint that will encode/decode the token manually (which is what the code sample in this repo does as well).

anishkarthick commented 2 years ago

unauthenticated endpoint ,by your saying and my understanding need to create another http trigger function then validate or verify the token in it am i right if no please clear it.

CharlieDigital commented 2 years ago

Yup; you are basically doing your own JWT :)