wwwlicious / servicestack-authentication-identityserver

A plugin for ServiceStack and IdentityServer that provides OpenIDConnect / OAuth 2.0 Single Sign-On Authentication
Other
29 stars 15 forks source link

No registered Auth Providers #13

Closed vsavic closed 6 years ago

vsavic commented 6 years ago

I'm trying to run this identity server auth with core, but when I add [Authenticate] attribute and try to invoke my method, I'm getting this as response:

{
  "responseStatus": {
    "errorCode": "Exception",
    "message": "No registered Auth Providers found matching any provider"
  }
}
stuartbfs commented 6 years ago

Try :

[Authenticate(IdentityServerAuthProvider.Name)]

vsavic commented 6 years ago

When I change it to that, I'm getting:


{
  "responseStatus": {
    "errorCode": "Exception",
    "message": "No registered Auth Providers found matching IdentityServer provider"
  }
}
stuartbfs commented 6 years ago

Can you provide your configuration setup?

vsavic commented 6 years ago

Here you go:

public class Startup
{
    //...
    public override void Configure(Container container)
    {
        //...
        Plugins.Add(new IdentityServerAuthFeature
          {
            AuthProviderType = IdentityServerAuthProviderType.UserAuthProvider,
            AuthRealm = AppSettings.Get<IdentityServer>("IdentityServer").Url, // The URL of the IdentityServer instance
            ClientId = AppSettings.Get<IdentityServer>("IdentityServer").ClientId, // The Client Identifier so that IdentityServer can identify the service
            ClientSecret = AppSettings.Get<IdentityServer>("IdentityServer").ClientSecret, // The Client Secret so that IdentityServer can authorize the service
            Scopes = "openid"
          });

      }
    //...
}
vsavic commented 6 years ago

I just saw some additional info on startup error:

ConfigurationException appHost.Config.WebHostUrl must be set to use the Identity Server User Login plugin so that the service can sent it's full http://url:port to the Identity Server User Login

So, everything was fine with this, it was just my configuration issue, I forgot to add WebHostUrl.