Identityserver4: invalid_request code challenge required. What is code challenge? How to get one?

Created on 31 Mar 2020  路  4Comments  路  Source: IdentityServer/IdentityServer4

Question

What is code challenge? How do I get it?

I'm trying to test my JS React SPA against IdentityServer4 DEMO server https://demo.identityserver.io/.
I do not set up local ASP .NET server, I'm not familiar with the technology. So I want to test against IdentityServer4 DEMO server https://demo.identityserver.io/.well-known/openid-configuration.

But demo server returns me

Sorry, there was an error : invalid_request
code challenge required

Documentation doesn't answer, it has only this which doesn't help much

screenshot-identityserver4 readthedocs io-2020 03 31-14_47_08

Minimal working example

My JS code

const config = {
  authority: "https://demo.identityserver.io",
  client_id: "interactive.confidential",
  redirect_uri: "http://localhost:3000/callback",
  response_type: "code",
  scope:"openid profile email api offline_access",
  post_logout_redirect_uri : "http://localhost:3000/post_logout",
};

const url = `https://demo.identityserver.io/connect/authorize?
client_id=${config.client_id}&
redirect_uri=${config.redirect_uri}&
response_type=${config.response_type}&
scope=${config.scope}`;

  const onFormSubmit = async (ev: React.FormEvent) => {
    window.location.replace(url);
  };

Response

screenshot-demo identityserver io-2020 03 31-14_43_26

Relevant parts of the log file

   <log goes here>
question wontfix

All 4 comments

Documentation doesn't answer, it has only this which doesn't help much

The docs are not intended to teach you the protocols. You need to learn those yourself, and here's the link to the spec in question: https://tools.ietf.org/html/rfc7636

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Questions are community supported only and the authors/maintainers may or may not have time to reply. If you or your company would like commercial support, please see here for more information.

Hi All,
Had this error to, but IHMO it's a typical error that is thrown when you have a server / client configuration mismatched. For example you enable PKCE on the server (for a specific client id) but on the respective client you disable PKCE protection in the OIDC configuration setup, then this kind of error (code challenge required) will be thrown. So check your configs first :).
Kr,
Emmanuel.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garymacpherson picture garymacpherson  路  3Comments

leastprivilege picture leastprivilege  路  3Comments

osmankibar picture osmankibar  路  3Comments

agilenut picture agilenut  路  3Comments

user1336 picture user1336  路  3Comments