Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

roblox-provider

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

roblox-provider

A Roblox OAuth2 provider for NextAuth.

latest
npmnpm
Version
1.0.19
Version published
Weekly downloads
28
180%
Maintainers
1
Weekly downloads
 
Created
Source

Roblox Provider

A Roblox OpenCloud/OAuth2 Provider For NextAuth.

install:

npm i roblox-provider

example usage:

import { RobloxProvider, RobloxProviderCallbacks_Jwt } from "roblox-provider"

export const authOptions = {
  providers: [
    RobloxProvider({
      clientId: process.env.ROBLOX_ID,
      clientSecret: process.env.ROBLOX_SECRET,
      redirectUri: process.env.ROBLOX_REDIRECT,
      scopes: ["openid", "profile"],
      include: ["name", "displayName", "avatar"]
    })
  ],

  callbacks: RobloxProviderCallbacks_Jwt
}

(You can replace RobloxProviderCallbacks_Jwt with RobloxProviderCallbacks_Database if you are using database based sessions)

Roblox Provider Settings

clientId: string - Your roblox oauth2 client id.

clientSecret: string - Your roblox oauth2 client secret.

scopes: array - The permissions that your oauth2 app needs.

include: array - The data that will be saved to a session. Defaults to ["name", "displayName", "avatar"]. Valid values are name, displayName, avatar, description, created and hasVerifiedBadge. (the users RobloxID is always included so theres no need to define it here).

redirectUri: string - The url to redirect to.

checks: array - The security checks to perform during OAuth. defaults to ['pkce', 'state']. It is not advised to change this setting unless you know what you are doing.

If you want to add more callbacks as well you can do the following:

export const authOptions = {
  ...

  callbacks: {
    ...RobloxProviderCallbacks_Jwt,

    // example of another callback
    async redirect() {
      return 
    },
  },

  ...
}

If you want to add more functionality to the callbacks used by roblox-provider then you can do the following

import { RobloxProvider, RobloxProviderJwtCallback, RobloxProviderSessionCallback } from "roblox-provider"

export const authOptions = {
  ...

  callbacks: {
    async jwt({ token, user }) {
      token = await RobloxProviderJwtCallback(token, user)

      // add your code here

      return token
    },
  
    async session({ session, token }) {
      session = await RobloxProviderSessionCallback(session, token)

      // add your code here

      return session
    }
  },

  ...
}

Keywords

Roblox

FAQs

Package last updated on 11 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts