0.0.8 • Published 2 years ago

@solid-auth/socials v0.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@solid-auth/socials

A collection of Solid Auth strategies for Oauth2 Social logins.

Current strategies:

  • Discord
  • Github
  • Google
  • Facebook
  • Microsoft
  • Strava
npm install @solid-auth/socials

Setting up a social provider

authenticator.use(
  new DiscordStrategy(
    {
      clientID: serverEnv.DISCORD_CLIENT_ID,
      clientSecret: process.env.env.DISCORD_CLIENT_SECRET,
      callbackURL: process.env.SITE_URL + '/api/auth/discord/callback',
      prompt: 'none',
    },
    async ({ profile }) => {
      let user = await prisma.user.findUnique({
        where: {
          id: profile.id,
        },
      })
      if (!user) {
        user = await prisma.user.create({
          data: {
            id: profile.id,
            displayName: profile.__json.username,
            avatar: profile.photos[0].value,
          },
        })
      }
      return user
    }
  )
)

Using a social provider

authClient.login('discord', {
  successRedirect: '/',
  failureRedirect: '/',
})
0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago