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

supabase.auth.admin.generateLink() returns only the same OTP #1357

Closed
2 tasks done
elbracht opened this issue Sep 11, 2023 · 1 comment
Closed
2 tasks done

supabase.auth.admin.generateLink() returns only the same OTP #1357

elbracht opened this issue Sep 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@elbracht
Copy link

elbracht commented Sep 11, 2023

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When calling the function generateLink several times, only the same OTP is generated for the same user. Because of this I can login once with verifyOtp but afterwards not anymore.

To Reproduce

const supabase createClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL,
  process.env.SUPABASE_SERVICE_ROLE_KEY,
  {
    auth: {
      autoRefreshToken: false,
      persistSession: false,
    },
  },
);

const { data } = await supabase.auth.admin.generateLink({
  type: 'magiclink',
  email,
});

const tokenHash = data.properties.hashed_token;

const { error } = await supabase.auth.verifyOtp({
  type: 'email',
  token_hash: tokenHash,
});

console.log(error);
// After the first successful login I get the error message:
// Database error finding user from email link

Expected behavior

In my opinion, I should get a new OTP as soon as the token has been used once or has expired.
With the function signInWithOtp I don`t have the problem and get a different token with every call.

System information

  • OS: macOS
  • Version of supabase-js: 2.33.2
  • Version of Node.js: 20.5.1
@elbracht elbracht added the bug Something isn't working label Sep 11, 2023
@hf hf transferred this issue from supabase/auth-js Dec 20, 2023
@Airbornharsh
Copy link

this is working fine. I am getting different Otp everytime

@hf hf closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants