
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@gadgetinc/auth
Advanced tools
`@gadgetinc/auth` is a `fastify` plugin that helps manage on platform authentication in [Gadget](https://gadget.dev).
@gadgetinc/auth is a fastify plugin that helps manage on platform authentication in Gadget.
This library implements the following features:
preValidation hooks.user and session model.yarn add @gadgetinc/auth
# or
npm install --save @gadgetinc/auth
This plugin can be registered with Gadget in either a boot plugin or route plugin.
To register the plugin:
// routes/+auth.js
import { Auth } from "@gadgetinc/auth";
import { api } from "gadget-server";
export default function (server) {
server.register(Auth, {
api,
providers: [
{
type: "google",
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
},
],
});
}
To protect a route:
// routes/GET-protected-route.js
const { preValidation } = require("@gadgetinc/auth");
module.exports = async function ({ reply }) {
await reply.send("this is a protected route!");
};
module.exports.options = {
preValidation,
};
Plugin options
api - your Gadget api clientredirectToSignIn - if a user is not signed in using the preValidation check, then redirect the user to the path specified by signInPath. Defaults to falsesignInPath - the path to your login page. This is where users will be redirected to if redirectToSignIn is set to true. Defaults to /signinproviders - an array of authentication providers
type - currently the only available type is "google"clientId - Google OAuth client idclientSecret - Google OAuth client secretscopes - optional OAuth scopes to request from the user. Defaults to ["email", "profile"] for GoogleFAQs
`@gadgetinc/auth` is a `fastify` plugin that helps manage on platform authentication in [Gadget](https://gadget.dev).
We found that @gadgetinc/auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.