Hey! Trying to get the Discord Auth to work and iv...
# help
a
Hey! Trying to get the Discord Auth to work and ive used
Copy code
const signInWithDiscord = async () => {
    const { user, session, error } = await supabase.auth.signIn({
      provider: 'discord',
    })
    console.log(user,session,error)
  }
this to fire on button click but the page switches to the login page and loses track of user, session and error
n
Hello @arzy! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
g
When using 3rd party auth, signIn does not comeback basically with anything. You need a redirectTo if you want to control where it goes, otherwise it uses your default in auth settings for the destination page.
n
arzy (2022-04-15)
a
Ah okay I see - so im trying to get the users discord username to be displayed, how would I be able to get access to that if signIn does not return with anything?
g
If you put
Copy code
supabase.auth.onAuthStateChange((event, session) => {
  console.log(event, session)
})
on your return page, you should see a signin event with session which will have a user object in it, or you can use .auth.user() ... after the signin event occurs
a
Yo you just saved me
Thank you
I couldnt find this anywhere on the docs
Bless you