2
votes

I just tested a working Web.Api named "WebApiServizio1" protected with a OAuth2 BearerAuthentication (Owin implementation) and it's been deployed on the root of my IIS WebServer.

I would like to change the current webserver configuration moving the "WebApiServizio1" web.Api inside a new website WEBAPI. So I can host more then one api (with the same host and port).

IIS: WEBAPI webSite Port:80 (AppPool: Integrated, 4.0)

Expected IIS Configuration

PROBLEM But when I try to autenticate with the OWIN Middleware I can't obtain the Token, I get a "404 - not found" response trying to reach the TokenEndpointPath.

Recap:

http://localhost/WebApiServizio1/ HTTP 403.14 - Forbidden CORRECT! http://localhost/WebApiServizio1/oauth/token/ HTTP 404.0 - Not Found - :(

This the current Owin.Startup configuration: Startup configuration

Client configuration: Client configuration

Any ideas?

3
I also having the same issue. Please post your solution.. if it is fixed.Krishna Mani
I'm sorry no solution at the moment, our project has been stopped.Tom
Thank you for your update, currently sub-domain(child application) won't support Token End PointPath in IIS, The only way is to create a new application and host the targeted WEB API solution.Krishna Mani

3 Answers

0
votes

the problem seems to be the trailing / after token in your PostAsync() call

instead write

using (HttpResponseMessage response = await client.PostAsync("/oauth/token", new FormUrlEncodedContent(values))) 

and it should work.

On a side note: when you initialize your RefreshTokenProvider with DateTime.UtcNow.AddHours(8), all your refresh tokens are valid until 8 hours after the programm was startet instead of 8 hours after the access token is issued.

0
votes

Check that your Owin Startup event is even firing and it attaches this url that is not found. In my case it wasn't due to wrong namespace.

0
votes

In my case, I deployed directly bin\ folder, but I forgot to publish the webapi, once I did it, everything worked like a charm ^_^