Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-auth

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-auth - npm Package Compare versions

Comparing version 0.2.6 to 1.0.0

dist/graphql-auth.cjs.development.js

64

package.json
{
"name": "graphql-auth",
"version": "0.2.6",
"description": "GraphQL authentication and authorization middleware",
"main": "build/index.js",
"types": "index.d.ts",
"version": "1.0.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist",
"src"
],
"engines": {
"node": ">=10"
},
"scripts": {
"build:watch": "babel -w --source-maps --ignore '**/__tests__/**' index.js --out-dir build",
"build": "rimraf build && babel --source-maps --ignore '**/__tests__/**' index.js --out-dir build",
"contrib:add": "all-contributors add",
"contrib:build": "all-contributors generate",
"test": "jest test"
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test",
"lint": "tsdx lint",
"prepare": "tsdx build"
},
"repository": {
"type": "git",
"url": "https://github.com/kkemple/graphql-auth"
"peerDependencies": {},
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
}
},
"keywords": [
"graphql",
"auth",
"authentication",
"authorization"
],
"author": "kurtiskemple@gmail.com",
"license": "MIT",
"bugs": {
"url": "https://github.com/kkemple/graphql-auth/issues"
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
},
"homepage": "https://github.com/kkemple/graphql-auth#readme",
"name": "graphql-auth",
"author": "Kurt Kemple",
"module": "dist/app.esm.js",
"devDependencies": {
"all-contributors-cli": "^4.5.0",
"babel-cli": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.5.2",
"babel-preset-stage-2": "^6.24.1",
"jest": "^21.2.1",
"rimraf": "^2.6.2"
"husky": "^4.2.5",
"tsdx": "^0.13.2",
"tslib": "^1.12.0",
"typescript": "^3.9.2"
}
}

@@ -1,5 +0,3 @@

# GraphQL Auth
# GraphQL Auth
[![Travis Build Status](https://travis-ci.org/kkemple/graphql-auth.svg?branch=master)](https://travis-ci.org/kkemple/graphql-auth)
🔒 Authentication and authorization middleware for GraphQL.

@@ -12,2 +10,3 @@

### How It Works
`graphql-auth` exports a single function (middleware) `withAuth`. This function takes two parameters, the first is `scope` (if any) for authorization, and the second is the `callback` to call when auth checking is complete. Let's look at an example:

@@ -27,2 +26,3 @@

The way this works is `withAuth` looks for a special `auth` property on the `context` of the resolver. It expects the `auth` property to have two properties of its own:
1. `isAuthenticated` to tell if the user is logged in

@@ -70,3 +70,3 @@ 2. `scope` scope of the logged in user (optional)

next();
},
}
);

@@ -82,12 +82,14 @@ };

```
> For more in depth examples take a look at the [`graphql-auth-examples`](https://github.com/kkemple/graphql-auth-examples) repo.
### Installation
### Installation
```shell
yarn add graphql-auth
```
### withAuth([scope,] callback)
*Without scope*:
_Without scope_:

@@ -105,3 +107,3 @@ ```javascript

*With scope*:
_With scope_:

@@ -119,3 +121,3 @@ ```javascript

*With dynamic scope*:
_With dynamic scope_:

@@ -140,6 +142,9 @@ ```javascript

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars1.githubusercontent.com/u/332115?v=4" width="100px;"/><br /><sub>artgibson</sub>](https://github.com/artgibson)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=artgibson "Code") | [<img src="https://avatars3.githubusercontent.com/u/1265681?v=4" width="100px;"/><br /><sub>HaNdTriX</sub>](http://henrikwenz.de/)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=HaNdTriX "Code") [📖](https://github.com/kkemple/graphql-auth/commits?author=HaNdTriX "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/841956?v=4" width="100px;"/><br /><sub>Pascal Birchler</sub>](https://pascalbirchler.com)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=swissspidy "Code") | [<img src="https://avatars2.githubusercontent.com/u/6640835?v=4" width="100px;"/><br /><sub>Andréas Hanss</sub>](https://www.linkedin.com/in/andreas-hanss/)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=ScreamZ "Code") [📖](https://github.com/kkemple/graphql-auth/commits?author=ScreamZ "Documentation") |
| :---: | :---: | :---: | :---: |
| [<img src="https://avatars1.githubusercontent.com/u/332115?v=4" width="100px;"/><br /><sub>artgibson</sub>](https://github.com/artgibson)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=artgibson 'Code') | [<img src="https://avatars3.githubusercontent.com/u/1265681?v=4" width="100px;"/><br /><sub>HaNdTriX</sub>](http://henrikwenz.de/)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=HaNdTriX 'Code') [📖](https://github.com/kkemple/graphql-auth/commits?author=HaNdTriX 'Documentation') | [<img src="https://avatars1.githubusercontent.com/u/841956?v=4" width="100px;"/><br /><sub>Pascal Birchler</sub>](https://pascalbirchler.com)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=swissspidy 'Code') | [<img src="https://avatars2.githubusercontent.com/u/6640835?v=4" width="100px;"/><br /><sub>Andréas Hanss</sub>](https://www.linkedin.com/in/andreas-hanss/)<br />[💻](https://github.com/kkemple/graphql-auth/commits?author=ScreamZ 'Code') [📖](https://github.com/kkemple/graphql-auth/commits?author=ScreamZ 'Documentation') |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc