https://supertokens.com/ logo
Title
p

productdevbook

12/12/2022, 6:45 AM
Nuxt 3 with github login and return this see problem. Iam see db my email adress etc. But client this problem
Error: No instance of Session found. Make sure to call the Session.init method.
n

nkshah2

12/12/2022, 6:46 AM
Hi
Can I see the code for where you are doing Github login?
p

productdevbook

12/12/2022, 6:48 AM
onGithubPressed
and callback
s

sattvikc

12/12/2022, 6:51 AM
@productdevbook , the plugin needs to be added as a client side plugin.
that can be done by renaming your plugin to supertokens.client.ts and update nuxt.config accordingly
p

productdevbook

12/12/2022, 6:58 AM
interested this is problem dont waith callback
In fact, if it waits, the result of 'OK' comes from the github login.
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
    console.log(response.fetchResponse)
dont data
response.status
and same
n

nkshah2

12/12/2022, 7:01 AM
Im not sure what youre trying to say, what do you mean by "if it waits"
p

productdevbook

12/12/2022, 7:02 AM
ts
<script lang="ts" setup>
import ThirdPartyEmailPassword from 'supertokens-web-js/recipe/thirdpartyemailpassword'

onMounted(async () => {
  await ThirdPartyEmailPassword.thirdPartySignInAndUp({}).then((res) => {
    console.log(res)
  }).catch((err) => {
    console.log(err)
  })
})
</script>
console.log empty
n

nkshah2

12/12/2022, 7:02 AM
.then
does not work with async await, you can either use async await or
.then
Not both
onMounted(async () => {
  const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
  console.log(response)
})
p

productdevbook

12/12/2022, 7:03 AM
empty
dont return data
n

nkshah2

12/12/2022, 7:04 AM
Whats the code you are using?
The full code
p

productdevbook

12/12/2022, 7:04 AM
ts
<script lang="ts" setup>
import ThirdPartyEmailPassword from 'supertokens-web-js/recipe/thirdpartyemailpassword'

onMounted(async () => {
  const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
  console.log(response)
})
</script>
auth/callback/[provider].vue
n

nkshah2

12/12/2022, 7:05 AM
And it logs an empty object?
p

productdevbook

12/12/2022, 7:06 AM
nothing is coming, not even network requests
n

nkshah2

12/12/2022, 7:07 AM
Can you check if you see any error or warnings in your console?
Browser console that is
Also try what @sattvikc suggested and make it a client side plugin
p

productdevbook

12/12/2022, 7:08 AM
yes empty all
n

nkshah2

12/12/2022, 7:08 AM
Try this
p

productdevbook

12/12/2022, 7:08 AM
it's already like this right now
s

sattvikc

12/12/2022, 7:09 AM
could you log something before the thirdparty.SignInUp to see if that hook is being called?
n

nkshah2

12/12/2022, 7:11 AM
he means log something before
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
this line
p

productdevbook

12/12/2022, 7:12 AM
ts
onMounted(async () => {
  console.log('mounted')
  const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
  console.log(response)
})
n

nkshah2

12/12/2022, 7:13 AM
And nothing shows up in the network tab either?
try {
  const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
  console.log(response)
} catch(e) {
  console.log(e)
}
Try changing it to this and see if it logs anything
Can you log something in the plugin you created where you call supertokens.init
See if that logs before this
p

productdevbook

12/12/2022, 7:20 AM
thank you change setting plugin now working
n

nkshah2

12/12/2022, 7:20 AM
Alright, happy to help
p

productdevbook

12/12/2022, 7:20 AM
ts
import SuperTokens from 'supertokens-web-js'
import Session from 'supertokens-web-js/recipe/session'
import ThirdPartyEmailPassword from 'supertokens-web-js/recipe/thirdpartyemailpassword'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.hook('app:mounted', () => {
    SuperTokens.init({
      appInfo: {
        apiDomain: 'http://localhost:3001',
        apiBasePath: '/auth',
        appName: 'aaa',
      },
      recipeList: [
        Session.init(),
        ThirdPartyEmailPassword.init(),
      ],
    })
  })
})
page:finish ->
app:mounted
n

nkshah2

12/12/2022, 7:21 AM
Ah right, glad you got it to work
p

productdevbook

12/12/2022, 7:23 AM
I will try to write to the library - npm and publish for nuxt 3
So more users come here and we all improve. I love open source.
ts
async function callAPI() {
  const response = await fetch(`${apiDomain}/sessioninfo`)
  if (response.status === 401) {
    // this means that the session has expired and the
    // user needs to relogin.
    window.location.assign('/auth')
    return
  }
  const json = await response.json()
  window.alert(`Session Information:\n${JSON.stringify(json, null, 2)}`)
}
your vue github add but empty data
sessioninfo url change ?
n

nkshah2

12/12/2022, 8:11 AM
session info is not an official API that we expose, its just part of the example apps
You can refer to the FDI for all the APIs that we provide, https://supertokens.com/docs/fdi