Skip to content

Commit

Permalink
Upgrade to Remix Auth v4 and use Arctic's OAuth2Client (#137)
Browse files Browse the repository at this point in the history
This PR does two things

1. It upgrade the strategy to work with Remix Auth v4, the strategy uses
`@mjackson/headers` to work with cookies and accepts an optional
`cookie` configuration that fallbacks to `oauth2`, this cookie is used
as the name of the cookie the strategy will use to keep the state and
code verifier.

The `cookie` can also be an object to customize path, maxAge, secure,
httpOnly, etc.

2. It change how it works internally to use the new Arctic's
OAuth2Client, this way the strategy just instantiate the client and
coordinate with the request->response flow how to read from the URL and
cookies and how to direct, but the actual logic for OAuth2 is on the
client.

This has a side-effect that now an identity provider that doesn't really
follow the spec will not work, for those is better to create a custom
strategy.
  • Loading branch information
sergiodxa authored Nov 25, 2024
1 parent 1f9a319 commit b99bccf
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 1,010 deletions.
Binary file modified bun.lockb
Binary file not shown.
59 changes: 16 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@
"version": "2.4.0",
"description": "A strategy to use and implement OAuth2 framework for authentication with federated services like Google, Facebook, GitHub, etc.",
"license": "MIT",
"funding": [
"https://github.com/sponsors/sergiodxa"
],
"keywords": [
"remix",
"remix-auth",
"auth",
"authentication",
"strategy"
],
"funding": ["https://github.com/sponsors/sergiodxa"],
"keywords": ["remix", "remix-auth", "auth", "authentication", "strategy"],
"author": {
"name": "Sergio Xalambrí",
"email": "[email protected]",
Expand All @@ -36,53 +28,34 @@
"sideEffects": false,
"type": "module",
"engines": {
"node": "^18.0.0 || ^20.0.0 || >=20.0.0"
"node": "^20.0.0 || >=20.0.0"
},
"files": [
"build",
"package.json",
"README.md"
],
"files": ["build", "package.json", "README.md"],
"exports": {
".": "./build/index.js",
"./package.json": "./package.json"
},
"dependencies": {
"@oslojs/crypto": "^0.6.2",
"@mjackson/headers": "^0.8.0",
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.0.0",
"@oslojs/oauth2": "^0.5.0",
"debug": "^4.3.4"
"arctic": "^2.3.0",
"debug": "^4.3.7"
},
"peerDependencies": {
"@remix-run/cloudflare": "^1.0.0 || ^2.0.0",
"@remix-run/node": "^1.0.0 || ^2.0.0",
"@remix-run/deno": "^1.0.0 || ^2.0.0",
"remix-auth": "^3.6.0"
},
"peerDependenciesMeta": {
"@remix-run/cloudflare": {
"optional": true
},
"@remix-run/node": {
"optional": true
},
"@remix-run/deno": {
"optional": true
}
"remix-auth": "^4.0.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@biomejs/biome": "^1.8.3",
"@remix-run/node": "^2.8.1",
"@remix-run/server-runtime": "^2.8.1",
"@biomejs/biome": "^1.9.4",
"@total-typescript/tsconfig": "^1.0.4",
"@types/bun": "^1.0.12",
"@types/bun": "^1.1.13",
"@types/debug": "^4.1.12",
"consola": "^3.2.3",
"msw": "^2.2.13",
"remix-auth": "^3.6.0",
"typedoc": "^0.26.2",
"typedoc-plugin-mdn-links": "^3.1.25",
"typescript": "^5.4.5"
"msw": "^2.6.6",
"remix-auth": "^4.0.0",
"typedoc": "^0.26.11",
"typedoc-plugin-mdn-links": "^4.0.1",
"typescript": "^5.7.2"
}
}
Loading

0 comments on commit b99bccf

Please sign in to comment.