api to accept header
hi all, how do we add an api to accept a header value sent from postman?
does it make sense to add like
above the api controller and add a CustomAuthorization and pass the request from postman to this class so we can reuse the CustomAuthorization
6 Replies
I'm having a hard time understanding what you exactly want to achieve
Is the purpose of the header to auth the api user?
usually from postman we can add a header and send to an api, i was trying to create a simple api that accept this "header"
yes, so it's like the controller of an api will check what header is passed to the api, and i was wondering how we check that "header".
You can use the built in [Authorize] to do this with schemes and stuff etc. Or something "easier" would be a simple actionfilter (http://codingsonata.com/secure-asp-net-core-web-api-using-api-key-authentication/ not sure if this a good way didn't read it all)
Aram
Coding Sonata
Secure ASP.NET Core Web API using API Key Authentication - Coding S...
This tutorial explains how to use API Key Authentication to secure your ASP.NET Core Web API using Custom Attribute and Custom Middleware.
we use the Authorize method since it allows us to easy add claims and stuff
oh wait, i think this is what im looking for
i'll try it out. thank you friend!