Passport strategy for Roblox
npm intall passport-roblox
This strategy uses the Roblox profile scope. The configuration requires clientID, clientSecret, a callback URL, and a scope. Client ID, Secret and applicable scopes can be found during creation of a Roblox OAuth2 application on the Creator Dashboard.
passport.use(new passportroblox({
clientID: process.env.clientid,
clientSecret: process.env.secret,
callbackURL: "http://localhost:8080/callback",
state: true,
scope: 'openid',
pkce: true
}, function (accessToken, refreshToken, profile, done) {
profile.
done(null, profile)
}));
Use passport.authenticate()
and use roblox
for it
app.get("/login", passport.authenticate('roblox'), (req, res, next) => { });
app.get("/callback", passport.authenticate('roblox', { failureRedirect: '/authfail'}), async (req, res) => {
res.redirect('/shh')
})