Socket
Socket
Sign inDemoInstall

@neo4j/graphql-plugin-auth

Package Overview
Dependencies
3
Maintainers
7
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo4j/graphql-plugin-auth

Auth decode plugins for @neo4j/graphql


Version published
Weekly downloads
687
decreased by-16.01%
Maintainers
7
Created
Weekly downloads
 

Readme

Source

@neo4j/graphql-plugin-auth

Auth decode plugins for @neo4j/graphql

  1. Documentation

Installation

$ npm install @neo4j/graphql-plugin-auth

Usage

Neo4jGraphQLAuthJWTPlugin

import { Neo4jGraphQL } from "@neo4j/graphql";
import { Neo4jGraphQLAuthJWTPlugin } from "@neo4j/graphql-plugin-auth";

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWTPlugin({
            secret: "super-secret",
        }),
    },
});

// Or you can initiate the secret with a function which will run to retrieve the secret when the request comes in

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWTPlugin({
            secret: (req) => {
                return "super-secret";
            },
        }),
    },
});

Neo4jGraphQLAuthJWKSPlugin

import { Neo4jGraphQL } from "@neo4j/graphql";
import { Neo4jGraphQLAuthJWKSPlugin } from "@neo4j/graphql-plugin-auth";

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWKSPlugin({
            jwksEndpoint: "https://YOUR_DOMAIN/well-known/jwks.json",
        }),
    },
});

//Or you can pass a function as jskwsEndpoint to compute the endpoint when the request comes in.

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWKSPlugin({
            jwksEndpoint: (req) => {
                let url = "https://YOUR_DOMAIN/well-known/{file}.json";
                const fileHeader = req.headers["file"];
                url = url.replace("{file}", fileHeader);
                return url;
            },
        }),
    },
});

Licence

Apache 2.0

Keywords

FAQs

Last updated on 11 Apr 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc