Skip to content

How to generate a session for Electron deep link auth without asking to log in again? #27181

Answered by igorlanko
igorlanko asked this question in Questions
Discussion options

You must be logged in to vote

Yes, actually! Though it's been quite some time, the refreshSession() is definitely not a suitable method for deep linking.

Instead, we need to get the hashed_token somehow, so that it's sent back to the app and the app creates a separate session with auth.verifyOtp().

So what I'm doing is sending user to site.com/auth/login?desktop=true, they complete login, server takes the new session, gets the user email from auth.getUser(), and then completely unexpected (for me):

// Generate magic link for user
// obviously need a service role key for this,
// so ensure it's secure
const { data: magicLink, error: magicLinkErr } = await supabaseAdmin.auth.admin.generateLink({
   type: 'magiclink',

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@igorlanko
Comment options

Answer selected by igorlanko
@yafkari
Comment options

@jczstudios
Comment options

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