Author : MD TAREQ HASSAN | Updated : 2020/06/19

Identity Server Project

Commands

dotnet new -i identityserver4.templates

dotnet new is4inmem

Identity Server - Scaffolding Project InMemory Store Step 1

Identity Server - Scaffolding Project InMemory Store Step 2

Identity Server - Scaffolding Project InMemory Store Step 3

Identity Server - Scaffolding Project InMemory Store Step 4

Identity Server - Scaffolding Project InMemory Store Step 5

Identity Server - Scaffolding Project InMemory Store Step 6

Identity Server - Scaffolding Project InMemory Store Step 7

Identity Server - Scaffolding Project InMemory Store Step 8

Identity Server - Scaffolding Project InMemory Store Step 9

Identity Server - Scaffolding Project InMemory Store Step 10

Identity Server - Scaffolding Project InMemory Store Step 11

Identity Server - Scaffolding Project InMemory Store Step 12

Identity Server - Scaffolding Project InMemory Store Step 13

Identity Server - Scaffolding Project InMemory Store Step 14

Identity Server - Scaffolding Project InMemory Store Step 15

Identity Server - Scaffolding Project InMemory Store Step 16

Identity Server - Scaffolding Project InMemory Store Step 17

Identity Server - Scaffolding Project InMemory Store Step 18

Testing with Postman

Run IdentityServer4 locally

Run IdentityServer4 locally

Required information for Postman to get Access Token

Open Config.cs & add a client for Postman


// ... ... ...

public static IEnumerable<Client> Clients =>
	new Client[]
	{
	
		// ... ... ...
		
		new Client
		{
			ClientId = "postman",
			ClientName = "Postman Client",

			AllowedGrantTypes = GrantTypes.CodeAndClientCredentials,
			RequirePkce = false,
			ClientSecrets = { new Secret("hovermind.postman".Sha256()) },

			RedirectUris = { "http://localhost:5003/signin-oidc" },
			FrontChannelLogoutUri = "http://localhost:5003/signout-oidc",
			PostLogoutRedirectUris = { "http://localhost:5003/signout-callback-oidc" },

			AllowOfflineAccess = true,
			AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile }
		}
		
		// ... ... ...
		
	};

Discovery document

Quickstart/TestUsers.cs

Other information

Example

Callback URL: http://localhost:5003/signin-oidc
Auth URL: https://localhost:5001/connect/authorize
Access Token URL: https://localhost:5001/connect/token
Client ID: postman
Client Secret: hovermind.postman
Scope: openid profile
State: foobarbaz

Username = "alice"
Password = "alice"

Getting access token (code flow + pkce) using Postman

See troubleshooting and solve issues first

Identity Server - Getting access token using Postman Step 1

Identity Server - Getting access token using Postman Step 2

Identity Server - Getting access token using Postman Step 3

Identity Server - Getting access token using Postman Step 4

Identity Server - Getting access token using Postman Step 5

Identity Server - Getting access token using Postman Step 6

Identity Server - Getting access token using Postman Step 7

Identity Server - Getting access token using Postman Step 8