@solid-auth/socials
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

@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: '/',
})

Readme

Keywords

none

Package Sidebar

Install

npm i @solid-auth/socials

Weekly Downloads

0

Version

0.0.8

License

ISC

Unpacked Size

36.5 kB

Total Files

4

Last publish

Collaborators

  • orjdev