Paolo ponzano - 462 - Mar 24, 2014

Hi Demis,
I’ve a ASP.Net MVC 5 web site with many pages calling REST services (in AJAX style) running on ServiceStack.
The main address of my web site is: http://localhost/ci2. The main address of my services is: http://localhost/ci2/api.
I need to share the user session between the MVC app and services. I’ve followed your guide (https://github.com/ServiceStack/ServiceStack/wiki/Run-servicestack-side-by-side-with-another-web-framework).

When I call my keep-alive service (http://localhost/ci2/api/hello) everything works fine.
When I try to call the auth service using (http://localhost/ci2/api/auth?provider=…&username=…&password=….) I get the following error:
Forbidden
 
 
Request.HttpMethod: GET
Request.PathInfo: /auth
Request.QueryString: provider=…&username=…&password=…
Request.RawUrl: /ci2/api/auth?provider=…&username=…&password=…
App.DebugLastHandlerArgs: GET|/ci2/api/auth|C:\Projects\CI2\master\CI2.Web\api\auth

What’s the problem?

Thank you

Can’t tell what’s wrong based on that description. What is the provider=xxx and does it match what you’ve registered in AuthFeature?

paolo ponzano:

Hi Demis,
xxx is my custom provider which inherits from CredentialsAuthProvider:

public class IdeaAuthProvider : CredentialsAuthProvider
{ … }

xxx is “idea”, so the auth URL is:

http://localhost/ci2/api/auth?provider=idea&username=…&password=.

or

http://localhost/ci2/api/auth/idea?username=…&password=.

Note that if I create a web app at the root level in order to have an URL like

http://localhost/auth?provider=idea&username=…&password=.

everything works fine.

Thank you

I can’t repro this, I can authenticate fine when ServiceStack is hosted on /api. 
Can you open a ticket on https://github.com/ServiceStack/Issues and provide as much info that I can use to repro this behavior. Adding the raw HTTP Headers will also help diagnose the issue.

paolo ponzano:

Hello Demis,I’ve created a support ticked with a demo attached, thanks