Basic API Rest authentication (C#)

Asked

Viewed 518 times

-1

I have an application made in ASP.MVC where I implemented ASP.NET Identity for user registration/login.

Now I have to create a Web API Rest with a simple authentication, just a single user and a single password.

Someone can give you tips on how to implement this basic authentication in the Web API?

Thank you

1 answer

-1


You have to add the following field to the HTTP header

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

where Qwxhzgrpbjppcgvuu2vzyw1l is the user and password encoded in Base64.

Know that your password security is zero. Anyone can right click on the browser and see the headers... the password will be there encoded in Base64, and qqer one can decode it...

Anyway... good luck to you ;)

  • Good Ttkdroid, I appreciate your reply. It was a good way to do if the password security was not zero.. Is there no other safer way? Thank you

  • It all depends on how your backend works. If it works with Basic authentication, or Digest or even Oauth2... if you are building the backend, look for JWT (JSON Web Token). I particularly recommend using tokens, but obviously the more elaborate and safe the higher the cost of implementing and testing.

  • Thank you Ttkdroid, I’ll do a search on what you said.

  • Valeu Miguel... if you think your question has been answered click there.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.