@opencreek/neo4j-graphql-plugin-auth
TypeScript icon, indicating that this package has built-in type declarations

2.2.0-oc.3 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @opencreek/neo4j-graphql-plugin-auth

Weekly Downloads

7

Version

2.2.0-oc.3

License

Apache-2.0

Unpacked Size

34.5 kB

Total Files

27

Last publish

Collaborators

  • happenslol
  • reckter
  • lionc
  • mhlz