diadal / universal-social-auth

SPA universal social auth
MIT License
40 stars 11 forks source link

self is not defined in Nuxt 3 project #28

Open stefusilviu opened 9 months ago

stefusilviu commented 9 months ago

I'm tryng to integrate the package in a Nuxt 3 app via plugins. Unfortunately I get this error:

[nuxt] [request error] [unhandled] [500] self is not defined     

Can you do an example of Nuxt 3 implementation? Thanks you.

diadal commented 9 months ago

try if this will help

https://github.com/diadal/universal-social-auth-test-nuxt

stefusilviu commented 9 months ago

I already saw that repository and I tried the Nuxt 3 specific approach for plugins, but without success.

NenoPetkov commented 7 months ago

Just make the Nuxt 3 plugin to render on the "client" side like this: universal-social-auth.client.ts

there you can use import { UniversalSocialauth, Providers } from "universal-social-auth"; without problems

And you can export the providers as well and use them in the component later

return {
    provide: {
      Oauth: Oauth,
      OauthProviders: (provider) => Providers[provider],
    },
 };