Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging of incorrect Nonce (mixup with State) #1458

Open
SchoolGuy opened this issue Jan 11, 2025 · 4 comments
Open

Debugging of incorrect Nonce (mixup with State) #1458

SchoolGuy opened this issue Jan 11, 2025 · 4 comments

Comments

@SchoolGuy
Copy link

SchoolGuy commented Jan 11, 2025

Describe the bug

After the user has logged in the client receives the correct access token which works when being used with the backend. The library correctly reports a failing nonce check.

Stackblitz example

I don't have a Stackblitz example but here are the relevant repositories:

To Reproduce

Steps to reproduce the behavior:

  1. Build the Backend and Frontend
  2. Start the devel compose
  3. Accept the incorrect certificate errors on all three services in the web browser
  4. Set the password in Casdoor for the testuser
  5. Try logging into the frontend

Expected behavior

I would expect the login to work since I can see that

Desktop (please complete the following information):

  • OS: openSUSE Tumbleweed
  • Browser: Chrome & Firefox
  • Version: Latest in Tumbleweed
  • Angular 18 with Material

Additional context

My authentication service is taken over from the example implementation of jeroenheijmans. If the network requests are closely monitored, one can see that the library takes the nonce from the state. I don't know if this is an incorrect Casdoor behavior but in the Casdoor UI under "Tokens" I can see that the Nonce is the one that is printed in the error message. As such it seems that all data is present but somewhere there is a mixup of nonce and state. I am unsure how to debug this mixup and if this is configuration or code-related.

@SchoolGuy
Copy link
Author

Here a screenshot to try and visualize what I mean by mixup:

grafik

The nonce in Session/Local-Storage (tried both ways) is this one eWdjODFsQVBob2F6YX55b19qM0F3cURtd1RvOHF0a2dFMHZIRURxVzlYdzEu (which is actually the state when I check the connection tab).

My hair is turning grey because I am trying to find this one out for a couple of days already.

@SchoolGuy
Copy link
Author

I found a promising lead on Stackoverflow: https://stackoverflow.com/a/77825619

@SchoolGuy
Copy link
Author

Yes, toggling the two settings on the application page fixes the issue:

  1. Signin session
  2. Auto signin

@SchoolGuy
Copy link
Author

Depending on the desire of the maintainer(s) I am willing to submit a PR that documents this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant