IdentityServer3 with ServiceStack and MVC Client

pank

I'm new to IdentityServer3 and am just starting to get it set up. It seems to be going quite well and I've been working on the Hybrid flow for an MVC app similar to that shown in Kevin Dockx's Pluralsight course (http://www.pluralsight.com/courses/building-securing-restful-api-aspdotnet) when I tried to configure IdentityServer with MVC error is pops up- Microsoft.IdentityModel.Protocols.OpenIdConnectProtocolException: invalid_request

ID Server:

new Client
{
   Enabled = true,
   ClientName = "MVC Client (Hybrid Flow)",
   ClientId = "mvc",
   Flow = Flows.Hybrid,
   RequireConsent = true,
   RedirectUris = new List<string>
   {"https://localhost:44358/"},                    
}

 var scopes = new List<Scope>{                    
    StandardScopes.OpenId,
    StandardScopes.Profile
 };

And the following is the code from the MVC client app

public void Configuration(IAppBuilder app)
    {            
        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = "Cookies",
            //CookieName = "ourcookiename"
        });

        var options = new OpenIdConnectAuthenticationOptions
        {
            ClientId = "mvc",
            Authority = "https://localhost:44367/identity/",
            RedirectUri = "https://localhost:44358/",
            // PostLogoutRedirectUri = "https://localhost:44300/",
            SignInAsAuthenticationType = "Cookies",
            ResponseType = "code id_token token",
            Scope = "openId profile"
        };
        app.UseOpenIdConnectAuthentication(options);         
    }

And also have to configure IdentityServer3 with ServiceStack' for this I used linkhttps://github.com/MacLeanElectrical/servicestack-authentication-identityserver` to authenticate service but in Global.aspx for new AppHost().Init(); it shows error-

'System.NullReferenceException' occurred in ServiceStack.dll but was not handled in user code
perirose

Here is how I'm doing mine

return new[]
        {
            new Client
            {
                Enabled = true,
                ClientId = "Client",
                ClientName = "SomeClient",
                Flow = Flows.Hybrid,
                RequireConsent = true,
                AllowedScopes = new List<string>
                {
                    "openid",
                    "profile",
                    "roles",
                    "api",
                    "offline_access"
                },
                RedirectUris = new List<string>
                {
                    Constants.Client
                },

                AccessTokenLifetime = 3600,

                ClientSecrets = new List<Secret>()
                {
                    new Secret("secret".Sha256())
                }
            }
        };


var scopes = new List<Scope>
        {

            //Identity Scopes
            StandardScopes.OpenId,
            StandardScopes.Profile,

            new Scope
            {
                Enabled = true,
                Name = "roles",
                DisplayName = "Roles",
                Description = "The roles you belong to.",
                Type = ScopeType.Identity,
                Claims = new List<ScopeClaim>
                {
                    new ScopeClaim("role")
                }
            },
            new Scope
            {
                Enabled = true,
                Name="api",
                DisplayName = "API Scope",
                Description = "To accesss the API",
                Type = ScopeType.Resource,
                Emphasize = false,
                Claims = new List<ScopeClaim>
                {
                    new ScopeClaim("role"),
                    new ScopeClaim("id")
                }

            },

            StandardScopes.OfflineAccess

        };

        return scopes;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

IdentityServer3 PostMan invalid_client

From Dev

IdentityServer3 - redirect to ADFS if client is on intranet

From Dev

Get redirect link from client in IdentityServer3 login page

From Dev

identityserver3 & MVC (web socket) & "websocket server" architecture

From Dev

Update of System.IdentityModel.Tokens.Jwt causing breaking change in IdentityServer3 Client

From Dev

oidc-client with IdentityServer3 - Angular2 SPA, how to refresh data access token

From Dev

IdentityServer3 pass Request.ClientCertificate from client request context

From Dev

ASP.Net MVC IdentityServer3 broke my webapi routing

From Dev

Using Core MVC Client with IdentityServer v3 - The client application is not known or is not authorized

From Dev

Servicestack client/text licensing

From Dev

ServiceStack ungraceful client disconnect

From Dev

IdentityServer 4 connect MVC5 as à client

From Dev

ServiceStack AutoQuery MVC controller

From Dev

ServiceStack AutoQuery MVC controller

From Dev

IdentityServer3 and php

From Dev

Timeout using ServiceStack.Client

From Dev

ServiceStack Soap 1.2 HTTPS Client

From Dev

How to use servicestack typed client?

From Dev

servicestack client authentication encrypt password

From Dev

ServiceStack - Autoquery & Swapping Client Templates

From Dev

ServiceStack - Validation not firing in MVC Action

From Dev

Resolving ServiceStack Services in MVC Controllers

From Dev

Servicestack: restrict MVC action by role

From Dev

ServiceStack - Validation not firing in MVC Action

From Dev

MVC4 + ServiceStack +....Glimpse?

From Dev

Servicestack: restrict MVC action by role

From Dev

MVC Client Is Not Redirecting To IdentityServer4 Login UI

From Dev

Secure IdentityManager with IdentityServer3

From Dev

disabling SSL for identityserver3

Related Related

  1. 1

    IdentityServer3 PostMan invalid_client

  2. 2

    IdentityServer3 - redirect to ADFS if client is on intranet

  3. 3

    Get redirect link from client in IdentityServer3 login page

  4. 4

    identityserver3 & MVC (web socket) & "websocket server" architecture

  5. 5

    Update of System.IdentityModel.Tokens.Jwt causing breaking change in IdentityServer3 Client

  6. 6

    oidc-client with IdentityServer3 - Angular2 SPA, how to refresh data access token

  7. 7

    IdentityServer3 pass Request.ClientCertificate from client request context

  8. 8

    ASP.Net MVC IdentityServer3 broke my webapi routing

  9. 9

    Using Core MVC Client with IdentityServer v3 - The client application is not known or is not authorized

  10. 10

    Servicestack client/text licensing

  11. 11

    ServiceStack ungraceful client disconnect

  12. 12

    IdentityServer 4 connect MVC5 as à client

  13. 13

    ServiceStack AutoQuery MVC controller

  14. 14

    ServiceStack AutoQuery MVC controller

  15. 15

    IdentityServer3 and php

  16. 16

    Timeout using ServiceStack.Client

  17. 17

    ServiceStack Soap 1.2 HTTPS Client

  18. 18

    How to use servicestack typed client?

  19. 19

    servicestack client authentication encrypt password

  20. 20

    ServiceStack - Autoquery & Swapping Client Templates

  21. 21

    ServiceStack - Validation not firing in MVC Action

  22. 22

    Resolving ServiceStack Services in MVC Controllers

  23. 23

    Servicestack: restrict MVC action by role

  24. 24

    ServiceStack - Validation not firing in MVC Action

  25. 25

    MVC4 + ServiceStack +....Glimpse?

  26. 26

    Servicestack: restrict MVC action by role

  27. 27

    MVC Client Is Not Redirecting To IdentityServer4 Login UI

  28. 28

    Secure IdentityManager with IdentityServer3

  29. 29

    disabling SSL for identityserver3

HotTag

Archive