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

bug: misleading messaging when logto do not understand which app is requesting sigin #6831

Open
2 tasks done
slavaGanzin opened this issue Nov 24, 2024 · 9 comments
Open
2 tasks done
Labels
feature-request Something cool or not cool

Comments

@slavaGanzin
Copy link

Describe the bug

I had some strange issue, that sometimes my login worked and sometimes it shows something strange:

dev:app logs  LogtoClientError: Sign-in session not found.
dev:app logs   code: "sign_in_session.not_found"
dev:app logs  
dev:app logs        at new LogtoClientError (/app/node_modules/@logto/client/lib/errors.js:13:9)
dev:app logs        at /app/node_modules/@logto/client/lib/client.js:373:19
dev:app logs  process.on unhandledRejection
dev:app logs  
dev:app logs   8 |     user_cancelled: 'The user cancelled the action.',
dev:app logs   9 |     missing_scope_organizations: `The \`${UserScope.Organizations}\` scope is required`,
dev:app logs  10 | });

Scopes were not an issue. And strangely it worked in Chrome, but didn't in Safari. Magic. I've tried to debug logto code, but there was no correlations, it worked 99% of the time, until it doesn't. I thought maybe problem was with my session solution, or because I have multiple instances of an app, maybe some conflicts with sessions? Phases of a moon? Who knows?

But finally after reading this: https://blog.logto.io/troubleshoot-logto-sign-in-404-not-found-error. I found out that it didn't work with localhost, while working completely fine with 127.0.0.1. I used localhost in Safari, and 127 in Chrome, so that is a root of magic behavior.

Expected behavior

Show descriptive error in SDK messaging: "I don't understand which app do you want to login, dummy." and a link to some docs would be enough. Saying that endpoint from which you came from wasn't registered in any of your apps and given list of registered endpoints would be ideal.

How to reproduce?

I wish I would know. I've tried to add localhost to all places in my configuration and logto app configuration trying to fix it, but localhost still do not work for me.

Context

  • Logto Cloud
  • "@logto/express": "^2.3.11",
@slavaGanzin slavaGanzin added the bug Something isn't working label Nov 24, 2024
@simeng-li
Copy link
Contributor

simeng-li commented Nov 25, 2024

Hi @slavaGanzin can you provide us a detailed user flow to reproduce this error? It seems like you have a miss-match callback URL configured.

@slavaGanzin
Copy link
Author

@simeng-li Yes, I do have a mismatched callback URL. This issue is not about my problem; it's about misleading Logto errors. It should say "You have a mismatched URL" and not give me some ill advice about unrelated features. How I got there is not important; what's important is that the Logto team should rework error messaging. This effort goes beyond this specific case

@simeng-li
Copy link
Contributor

Sounds reasonable to me. @wangsijie can you take a look?

@slavaGanzin
Copy link
Author

{"code":"oidc.invalid_redirect_uri","message":"redirect_uri did not match any of the client's registered redirect_uris.","error":"invalid_redirect_uri","error_description":"redirect_uri did not match any of the client's registered redirect_uris","state":"XXXX","iss":"https://XXXX.logto.app/oidc"}

So you are doing this, but client barks on a wrong tree.

I would prefer if it will show url I wanted redirect to and what are available options. Because as I found out today my problem that somehow I got redirect to http and not https, so that was why there were no "match"

@wangsijie
Copy link
Contributor

The SDK can only detect that “no sign-in flow was initiated,” resulting in the error message: “Sign-in session not found.” It cannot determine the underlying cause of this issue, so I don’t believe we should change the error message. However, we can certainly add a debug link to the documentation website for further guidance.

@wangsijie wangsijie removed their assignment Dec 23, 2024
@wangsijie wangsijie added feature-request Something cool or not cool and removed bug Something isn't working labels Dec 23, 2024
@slavaGanzin
Copy link
Author

@wangsijie I showed the error from original request, that has a proper error. But it is wrapped up in try catch in your code, so it hides descriptive error and outputs misleading one.

p.s. And one little ask more, please stop showing errors in languages, detected based on IP. If I'm using servers hosted in Finland, it doesn't make me finish.

@wangsijie
Copy link
Contributor

So there are two things to do:

  1. In SDK, show original error message from the server.
  2. In Server, detect lanuages only based on request IP address.

@slavaGanzin
Copy link
Author

  1. My question is why I get error messages in different languages?

@ukhack
Copy link

ukhack commented Jan 2, 2025

the same.
logto works in docker,can not vist another docker container?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Something cool or not cool
Development

No branches or pull requests

4 participants