openiddict / openiddict-samples

.NET samples for OpenIddict

Home Page:https://documentation.openiddict.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue: "Velusia" sample code does not work

robertkhou opened this issue · comments

Sample code for "Velusia" client/server project is not working as expected.

To reproduce

  1. Download sample code
  2. Run both Velusia Server and Velusia Client
  3. Client on "Sign in" button via Velusia client web app

Error

invalid_request The specified 'redirect_uri' is not valid for this client application.

"warn: OpenIddict.Core.OpenIddictApplicationManager[0]
Client validation failed because 'https://localhost:44338/signin-oidc' was not a valid redirect_uri for mvc.
fail: OpenIddict.Server.OpenIddictServerDispatcher[0]
The authorization request was rejected because the redirect_uri was invalid: 'https://localhost:44338/signin-oidc'."

note: After verifying the server project, it was found that https://localhost:44338/signin-oidc is actually a valid redirect uri

I suspect you're simply using an obsolete clone or are not taking a look at the right branch (dev).

The sample code if from "dev" branch, and I just verified the project uses .NET 5 and its running OpenIddict 3.0.0

I redownloaded the sample code from the "dev" branch, i'm getting the same error message as described above.

Is there a chance you're running the sample with a database created a while ago, when the redirect_uris were not HTTPS address? Try to delete and recreate the DB.

I just checked the database records and it was using http rather than https, (this might have been from a previous version), a quick database update resolved the issue! 👍

Hi, I am currently having this same problem trying to replicate this project in NET 5.0. The only difference is my project is not using Quartz.

As you guys discussed before, I have checked the redirect_uri value in my database and my OpenIddictApplications.RedirectUris value is:
["https://localhost:44338/signin-oidc"]

When I run click "Sign in", after returning a challenge from /login, it doesn't even hit the /connect/authorize endpoint and gives me the same error:
The specified 'redirect_uri' is not valid for this client application.

Any ideas? Maybe the exclusion of Quartz has broken something in my project? Thank you.

Hi, I am currently having this same problem trying to replicate this project in NET 5.0. The only difference is my project is not using Quartz.

As you guys discussed before, I have checked the redirect_uri value in my database and my OpenIddictApplications.RedirectUris value is: ["https://localhost:44338/signin-oidc"]

When I run click "Sign in", after returning a challenge from /login, it doesn't even hit the /connect/authorize endpoint and gives me the same error: The specified 'redirect_uri' is not valid for this client application.

Any ideas? Maybe the exclusion of Quartz has broken something in my project? Thank you.

I fixed my problem. It turns out I was using the server url instead of the client url for the RedirectUris database values. Now it is able to hit the /connect/authorize endpoint.