ABC DEF
ABC DEF

Reputation: 329

Unable to run IdentityServer 4 (.Net core 3.1) with MVC (.Net core MVC 3.1)

I am trying to implement IdentityServer4 in .Net core 3.1

I get below message in debug window:

IdentityServer4.Hosting.IdentityServerMiddleware: Information: Invoking IdentityServer endpoint:         IdentityServer4.Endpoints.AuthorizeEndpoint for /connect/authorize
IdentityServer4.Validation.AuthorizeRequestValidator: Error: Invalid redirect_uri:          https://localhost:44388/signin-oidc
   {
     "ClientId": "testClient",
     "ClientName": "Security.Client",
     "AllowedRedirectUris": [
     "http://localhost:44388/siginin-oidc"
  ],
  "SubjectId": "anonymous",
  "RequestedScopes": "",
   "Raw": {
  "client_id": "testClient",
  "redirect_uri": "https://localhost:44388/signin-oidc",
  "response_type": "code id_token",
  "scope": "openid profile offline_access",
  "response_mode": "form_post",
  "nonce": "637208292641572630.ODk4NzdjNWEtMzNhOC00MmMwLThlNDAtZDc4YzcxZGUxMjM5MjMyMmU5NzUtY2IwNC00Zjg2LThmZDUtNmNlNDM3YjI0ODNk",    "state": "CfDJ8AywpzlcvXBBkeIc2klEDRx1T9KQXlL4fQ9H23M0c-gOdQy9WdjC9EQo0uStq6ANZoCuVLa3e2za0THaInRuEE0OoHYCwORHlJIbv08hV_NSQl94TZTA80t-sxmwQuLyGq5t5kIO4n8e39YUlQKn3A5ybfO9jf-1Ryu1vn2cdZwMxpSfzkoCSq7OsZB_eOfqItU1UlahnUzizJTabGQamFfJKqT1kx5PvxY4NZEldrixJ1oy6RULk5xRhwf6awC5vQf7jds8PU9n7EPUB-yIX-TXXlhLEPPrGyleCiiqQV94",
  "x-client-SKU": "ID_NETSTANDARD2_0",
  "x-client-ver": "5.5.0.0"
     }
    }

My UI is .Net core 3.1 MVC

my IdentityServer url is displayed as http://localhost:44387/

enter image description here

on click of Discovery Document link I can see below

enter image description here

As of now I added Hardcode a Client and 2 Users:

enter image description here

enter image description here

enter image description here

Below is my server folder structure. wwwroot, QuickStart, Views folder I directly coped and pasted from url https://github.com/IdentityServer/IdentityServer4.Quickstart.UI

enter image description here

On my MVC side :

enter image description here

enter image description here

On Home page I added a link to call Login action enter image description here

My MVC url is https://localhost:44388/ Now when I click on Signin it goes to Login action for sure enter image description here

and then below error page is displayed: enter image description here

Upvotes: 2

Views: 340

Answers (1)

Mehrdad
Mehrdad

Reputation: 1731

Change you client's configurations. AllowedRedirectUris doesn't match to requested url

"AllowedRedirectUris": [
 "http://localhost:44388/siginin-oidc"

]

you should change http to https and it'll works.

Upvotes: 5

Related Questions