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

signInUserWithQrCode method lacks manual abort functionality #782

Open
johnhom1024 opened this issue Mar 16, 2025 · 0 comments
Open

signInUserWithQrCode method lacks manual abort functionality #782

johnhom1024 opened this issue Mar 16, 2025 · 0 comments

Comments

@johnhom1024
Copy link

I'm currently working with the gramjs project and have encountered an issue with the signInUserWithQrCode method.
The signInUserWithQrCode method is designed to handle the process of signing in a user using a QR code. However, it appears that there is no way to manually pause this process. In some real-world scenarios, users might need to interrupt the QR code signing-in process due to various reasons, such as a sudden change in network conditions, or they might have found an alternative way to log in.

The lack of a manual pause feature not only limits the flexibility of the user experience but also poses potential risks

I believe that adding a manual pause functionality to the signInUserWithQrCode method would significantly enhance the usability.

Here is my example code to manualy abort:

  const abortPromise = new Promise((resolve, reject) => {
   // add abortEmitter param to listen abort event
    authParams?.abortEmitter.on("abort", () => {
          reject("Aborted")
      });
  });

  try {
      await Promise.race([updatePromise, inputPromise, abortPromise]);
  } catch (err) {
      throw err;
  } finally {
      isScanningComplete = true;
  }
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