Skip to content

Auth #3

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

Closed
kiwicopple opened this issue Jul 14, 2020 · 4 comments · Fixed by #4
Closed

Auth #3

kiwicopple opened this issue Jul 14, 2020 · 4 comments · Fixed by #4
Assignees

Comments

@kiwicopple
Copy link
Member

Tracks progress on supabase/supabase#111

@kiwicopple kiwicopple self-assigned this Jul 14, 2020
@awalias
Copy link
Member

awalias commented Jul 14, 2020

issue to discuss the specification of methods in supabase-js to invoke auth endpoints on auth/v1

the endpoints that will be targeted are:

`auth/v1/signup`
`auth/v1/login` (actually makes a claim on the gotrue /token endpoint. also does token refreshing)
`auth/v1/logout`
`auth/v1/recover`? (sends recovery email)
`auth/v1/user`? (returns current user details)
`auth/v1/verify`? (verifies a token sent over email to activate an account)
`auth/v1/invite`? (sends invite email)

more details regarding the function of the endpoints found here (you'll have to scroll past the env vars to the relevant section)

initial idea discussed with @kiwicopple was to allow the user to create a single client and call methods on an auth namespace like:

import { createClient } from '@supabase/supabase-js'

const supabase = createClient(URL, KEY)

await supabase.auth.signup(new_email, new_password)
await supabase.auth.login(email, password) // might also return jwt so it can be managed manually 
await supabase.auth.logout()

signup (if not requiring email confirmation) and login will set a cookie containing the auth-token, which will then be sent in a header for any call to logout, or calls to rest or realtime methods (subscribe(), select() etc.)

@awalias
Copy link
Member

awalias commented Jul 14, 2020

just linking this here netlify/gotrue#255 as the gotrue /token interface may change

@awalias
Copy link
Member

awalias commented Jul 15, 2020

I think we also want to take on the work of refreshing the token depending on the jwt_expiry built into the client

@kiwicopple
Copy link
Member Author

Cross-referencing supabase/postgres#27 which has a JWT dependency

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

Successfully merging a pull request may close this issue.

2 participants