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

Magic Link generated with generateLink opens the app but is not handled by the SDK #1116

Open
augustogiavedoni opened this issue Feb 7, 2025 · 2 comments
Labels
auth This issue or pull request is related to authentication documentation Improvements or additions to documentation

Comments

@augustogiavedoni
Copy link

Describe the bug

I am generating a Magic Link on my server-less backend using the generateLink method exposed by the admin interface of the Supabase package for Javascript. When pressing the action_link returned by such method, my app opens but the deep-link is not detected by Supabase (I can notice when it does because a flutter: supabase.supabase_flutter: INFO: handle deeplink uri message appears). If I generate a Magic Link using the signInWithOtp method on my app, it works as expected but I lack the possibility to use my custom template.

To Reproduce

Steps to reproduce the behavior:

  1. Generate a Magic Link using the generateLink method exposed by the admin interface (Javascript).
  2. Copy and paste the action_link generated by such method on your phone's web browser.
  3. When asked if your app should be opened press "Yes".
  4. See error

Expected behavior

When pressing the Magic Link generated by generateLink, the user should be able to sign into the app.

Versions:

  • @supabase/supabase-js: 2.48.1
  • supabase_flutter: 2.8.3

Additional context

The Magic Link is generated using a server-less back-end to be able to inject it inside a custom template that also has information related to the user.

@augustogiavedoni augustogiavedoni added the bug Something isn't working label Feb 7, 2025
@dshukertjr dshukertjr added the auth This issue or pull request is related to authentication label Feb 9, 2025
@dshukertjr
Copy link
Member

We definitely need to update the docs to better explain this, but you need to initialize client-side Supabase SDK with the explicit flow in order for the it to detect the link.

await Supabase.initialize(
  url: 'your-url',
  anonKey: 'your-anon-key',
  authOptions: FlutterAuthClientOptions(
    authFlowType: AuthFlowType. implicit,
  ),
);

@dshukertjr dshukertjr added documentation Improvements or additions to documentation and removed bug Something isn't working labels Feb 10, 2025
@augustogiavedoni
Copy link
Author

Hi @dshukertjr! Thanks for your response!

Tried your suggestion and it worked as expected! I'll let you decide whether this "bug" should be closed or not because I don't know if you need it to update the documentation.

Best regards,

Augusto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth This issue or pull request is related to authentication documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants