Skip to content

Authentication in serverless function #1067

Answered by awalias
eunjae-lee asked this question in Questions
Discussion options

You must be logged in to vote

ah yes ok

if you have authenticated a user in the browser like:

  let { user, session, error } = await supabase
    .auth.signIn({ email: 'ant@boo.com', password: 'smoothmoves11'})

then session will contain session.access_token which will look something like:

access_token : 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjE3Nzc1MTQ2LCJzdWIiOiIwMDE3YmZlZC0wZThmLTRkOTgtYTI3MC1lYmE5ZjUwOWI2MDciLCJlbWFpbCI6ImFudEBib28uY29tIiwiYXBwX21ldGFkYXRhIjp7InByb3ZpZGVyIjoiZW1haWwifSwidXNlcl9tZXRhZGF0YSI6e30sInJvbGUiOiJhdXRoZW50aWNhdGVkIn0.X-uCLBUGtNcO586ZIgo-RsOC6uoBaATYZeVvCVLbwz4'

if you put this into https://jwt.io/ you will see it decodes to:

{
  "aud": "authenticated",…

Replies: 5 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@eunjae-lee
Comment options

@personsg
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@eunjae-lee
Comment options

@silasabbott
Comment options

@aditodkar
Comment options

@danarchos
Comment options

Answer selected by eunjae-lee
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@princefishthrower
Comment options

@stukennedy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
10 participants