0.0.8 • Published 1 year ago

@solid-auth/socials v0.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago