asolovyov
asolovyov

Reputation: 973

How to pass ASP.NET Identity user credentials to WebRequest

I have a ASP.NET MVC web application with ASP.NET Identity authentication. I need to create a WebRequest in backend code in controller to call WebAPI method of different web application with ASP.NET Identity authentication.

So, how can I obtain current user credentials to pass it to HttpWebRequest? I tried to get it through CreadentialsCache, but it is not initialized.

I am using Owin implementation to setup Identity authentication in my web applications.

Upvotes: 0

Views: 968

Answers (1)

trailmax
trailmax

Reputation: 35106

I'm afraid you might be out of luck here. In default Identity configuration password is always stored as a salted hash. The only times password is available in memory is when user types it in a form and submits it - on password change or login actions.

But depending on your API you are working with - you might login there at the same time user logs into your application and get an auth-token to use later - similar to auth-cookie you get in MVC-app

Upvotes: 1

Related Questions