Skip to content

Commit

Permalink
feat: add react AuthProvider and useAuth() hook
Browse files Browse the repository at this point in the history
The AuthProvider works in conjunction with the rest of the package, and
makes it easy to leverage it in for example NextJS based projects
  • Loading branch information
mvantellingen committed Oct 24, 2024
1 parent 03e5173 commit 27ff010
Show file tree
Hide file tree
Showing 8 changed files with 471 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-spoons-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@labdigital/federated-token-react": patch
---

Initial version
1 change: 1 addition & 0 deletions packages/react/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/**
3 changes: 3 additions & 0 deletions packages/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["../../.eslintrc.cjs"],
};
65 changes: 65 additions & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@labdigital/federated-token-react",
"version": "0.13.2",
"description": "Federate JWT tokens for React clients",
"module": "./dist/index.js",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"type": "module",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"keywords": [
"graphql",
"authentication",
"react"
],
"author": "Lab Digital <opensource@labdigital.nl>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/labd/node-federated-token"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsup",
"test": "vitest run",
"test:ci": "vitest run --coverage",
"tsc": "tsc --noEmit",
"format": "eslint src --fix && prettier --write .",
"lint": "eslint src && prettier --check ."
},
"files": [
"dist",
"src"
],
"dependencies": {
"js-cookie": "3.0.5",
"jsonwebtoken": "9.0.2"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/js-cookie": "3.0.6",
"@types/jsonwebtoken": "9.0.6",
"@types/react": "18.3.3",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@vitest/coverage-v8": "1.6.0",
"eslint": "^8.57.0",
"eslint-plugin-unused-imports": "^4.0.0",
"node-mocks-http": "^1.14.1",
"prettier": "^3.3.1",
"tsup": "^8.1.0",
"typescript": "^5.4.5",
"vitest": "1.6.0"
},
"peerDependencies": {
"react": ">= 18.0.0",
"graphql": ">= 16.6.0"
}
}
4 changes: 4 additions & 0 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use client";
export { AuthProvider } from "./provider";
export { useAuth } from "./provider";
export { type AuthProviderProps } from "./provider";
Loading

0 comments on commit 27ff010

Please sign in to comment.