Nuxt 3 with github login and return this see probl...
# support-questions-legacy
p
Nuxt 3 with github login and return this see problem. Iam see db my email adress etc. But client this problem
Copy code
Error: No instance of Session found. Make sure to call the Session.init method.
n
Hi
Can I see the code for where you are doing Github login?
p
onGithubPressed
and callback
s
@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
interested this is problem dont waith callback
In fact, if it waits, the result of 'OK' comes from the github login.
Copy code
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
    console.log(response.fetchResponse)
dont data
response.status
and same
n
Im not sure what youre trying to say, what do you mean by "if it waits"
p
Copy code
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
.then
does not work with async await, you can either use async await or
.then
Not both
Copy code
onMounted(async () => {
  const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
  console.log(response)
})
p
empty
dont return data
n
Whats the code you are using?
The full code
p
Copy code
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
And it logs an empty object?
p
nothing is coming, not even network requests
n
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
yes empty all
n
Try this
p
it's already like this right now
s
could you log something before the thirdparty.SignInUp to see if that hook is being called?
n
he means log something before
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
this line
p
Copy code
ts
onMounted(async () => {
  console.log('mounted')
  const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
  console.log(response)
})
n
And nothing shows up in the network tab either?
Copy code
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
thank you change setting plugin now working
n
Alright, happy to help
p
Copy code
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
Ah right, glad you got it to work
p
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.
Copy code
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
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
5 Views