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

Auth: Add TS types for auth method options #7745

Merged
merged 7 commits into from
Mar 4, 2023

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Mar 3, 2023

Provide types for the auth method options, like options in logIn(options) and signUp(options)

Users who were previously (probably unknowingly) passing unsupported parameters to logIn, signUp and a few more methods will now see TS type errors when trying to build their code base, requiring them to fix their code.

@replay-io
Copy link

replay-io bot commented Mar 3, 2023

16 replays were recorded for 880069a.

image 0 Failed
image 16 Passed
    requireAuth graphql checks
          ```
          locator.waitFor: Target closed
          =========================== logs ===========================
          waiting for locator('.rw-form-error-title').locator('text=You don\'t have permission to do that') to be visible
          ============================================================
          ```
        </ol>
      </details>
      <li><a href=https://app.replay.io/recording/f559e057-5980-4758-aa44-38bd11cde531>useAuth hook, auth redirects checks</a></li>
      <li><a href=https://app.replay.io/recording/b36dd723-6ee0-4cc1-b0fc-996a09cf3f14>Check that <meta> tags are rendering the correct dynamic data</a></li>
      <li><a href=https://app.replay.io/recording/58e1f9c8-2816-405e-8614-4d9bd6a46b32>Check that a specific blog post is prerendered</a></li>
      <li><a href=https://app.replay.io/recording/50191145-60dc-4e07-ad50-8b6a32522102>Check that about is prerendered</a></li>
      <li><a href=https://app.replay.io/recording/c5e9fb50-5789-4071-93a6-94b13c7c0a6a>Check that homepage is prerendered</a></li>
      <li><a href=https://app.replay.io/recording/c301b296-1897-4b43-b32b-6f2ef91348fb>Check that you can navigate from home page to specific blog post</a></li>
      <li><a href=https://app.replay.io/recording/e120d618-d8a6-4ab7-812f-464ff06ca190>Waterfall prerendering (nested cells)</a></li>
      <li><a href=https://app.replay.io/recording/8a44d21a-d5fb-4dce-b876-bb08f650a49d>RBAC: Admin user should be able to delete contacts</a></li>
      <li><a href=https://app.replay.io/recording/a6e71dad-23a8-496f-8cd3-b1f270490a48>RBAC: Should not be able to delete contact as non-admin user</a></li>
      <li><a href=https://app.replay.io/recording/1f928963-ae36-4262-ba5c-1cf5eb17fed9>Smoke test with dev server</a></li>
      <li><a href=https://app.replay.io/recording/5f698c02-dbd7-4078-b32e-7bfeb1b983f4>Smoke test with rw serve</a></li>
      <li><a href=https://app.replay.io/recording/112ebdae-d091-4fad-90ee-d72dc001de70>Loads Cell mocks when Cell is nested in another story</a></li>
      <li><a href=https://app.replay.io/recording/298f58d6-7d1a-4535-befa-7c494169af14>Loads Cell Stories</a></li>
      <li><a href=https://app.replay.io/recording/59339714-ed4b-4a2e-8826-4df1f449d1d0>Loads MDX Stories</a></li>
      <li><a href=https://app.replay.io/recording/7dda2bef-0de3-4cc8-9828-3f3815fc3f22>Mocks current user, and updates UI while dev server is running</a></li>
      

View test run on Replay ↗︎

@dthyresson dthyresson self-assigned this Mar 3, 2023
@dthyresson dthyresson added the release:breaking This PR is a breaking change label Mar 3, 2023
@dthyresson dthyresson changed the title Auth: method option types Auth: Support Supabase v2 Auth with method option types Mar 3, 2023
@dthyresson
Copy link
Contributor

I have integrated my Supabase v2 PR #7719 with this to test out the types -- which work great!

This PR also adds tests for the Supabase auth integrations: password, otp/passwordless, id token, and sso.

@dthyresson
Copy link
Contributor

@Tobbe please have a quick review if my combining v2 and the auth types works for you.

It was rather nice to write tests with all the proper types as it knew when my provider was missing -- or invalid.

TODO: I am going to add docs for each of the methods similar to: https://supabase.com/docs/reference/javascript/auth-signinwithpassword

@dthyresson dthyresson marked this pull request as ready for review March 3, 2023 18:03
@dthyresson
Copy link
Contributor

Added docs to explain how to login with various methods. but, I just noticed there was no test or doc for sign up. Will add.

@dthyresson
Copy link
Contributor

cc @bnn1

Fixes #7689

@dthyresson dthyresson linked an issue Mar 3, 2023 that may be closed by this pull request
1 task
@Tobbe Tobbe changed the title Auth: Support Supabase v2 Auth with method option types Auth: Support Supabase v2 Auth and add TS types for auth method options Mar 3, 2023
@Tobbe Tobbe force-pushed the tobbe-auth-method-option-types branch from 878ade6 to 74b2a06 Compare March 3, 2023 19:40
@Tobbe Tobbe changed the title Auth: Support Supabase v2 Auth and add TS types for auth method options Auth: Add TS types for auth method options Mar 3, 2023
@Tobbe
Copy link
Member Author

Tobbe commented Mar 3, 2023

I moved the upgrade of Supabase to v2 back into #7719

@Tobbe Tobbe merged commit 85ba8f7 into redwoodjs:main Mar 4, 2023
@redwoodjs-bot redwoodjs-bot bot added this to the next-release milestone Mar 4, 2023
@Tobbe Tobbe deleted the tobbe-auth-method-option-types branch March 4, 2023 07:57
@jtoar jtoar modified the milestones: next-release, v5.0.0 Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:breaking This PR is a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug?]: Supabase auth handlers have untyped options param
3 participants