Skip to content

How to log-in to an existing GitHub account? #748

Closed Answered by MattHeslington
MattHeslington asked this question in Help
Discussion options

You must be logged in to vote

The 'try' statement was wrong. This works:

try {
        const { existingUser, providerUser, createUser } = await githubAuth.validateCallback(code)
        const user =
            existingUser ??
            (await createUser({
                username: providerUser.login,
                ...
            }))
        const session = await auth.createSession(user.userId)
        locals.auth.setSession(session)
    } 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MattHeslington
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant