@cloudflare/workers-oauth-provider 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/oauth-provider.js +13 -0
- package/package.json +9 -10
package/dist/oauth-provider.js
CHANGED
|
@@ -433,6 +433,9 @@ var OAuthProviderImpl = class {
|
|
|
433
433
|
if (redirectUri && !clientInfo.redirectUris.includes(redirectUri)) {
|
|
434
434
|
return this.createErrorResponse("invalid_grant", "Invalid redirect URI");
|
|
435
435
|
}
|
|
436
|
+
if (!isPkceEnabled && codeVerifier) {
|
|
437
|
+
return this.createErrorResponse("invalid_request", "code_verifier provided for a flow that did not use PKCE");
|
|
438
|
+
}
|
|
436
439
|
if (isPkceEnabled) {
|
|
437
440
|
if (!codeVerifier) {
|
|
438
441
|
return this.createErrorResponse("invalid_request", "code_verifier is required for PKCE");
|
|
@@ -1071,6 +1074,16 @@ var OAuthHelpersImpl = class {
|
|
|
1071
1074
|
if (responseType === "token" && !this.provider.options.allowImplicitFlow) {
|
|
1072
1075
|
throw new Error("The implicit grant flow is not enabled for this provider");
|
|
1073
1076
|
}
|
|
1077
|
+
if (clientId) {
|
|
1078
|
+
const clientInfo = await this.lookupClient(clientId);
|
|
1079
|
+
if (clientInfo && redirectUri) {
|
|
1080
|
+
if (!clientInfo.redirectUris.includes(redirectUri)) {
|
|
1081
|
+
throw new Error(
|
|
1082
|
+
`Invalid redirect URI. The redirect URI provided does not match any registered URI for this client.`
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1074
1087
|
return {
|
|
1075
1088
|
responseType,
|
|
1076
1089
|
clientId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/workers-oauth-provider",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "OAuth provider for Cloudflare Workers",
|
|
5
5
|
"main": "dist/oauth-provider.js",
|
|
6
6
|
"types": "dist/oauth-provider.d.ts",
|
|
@@ -13,14 +13,6 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsup",
|
|
18
|
-
"build:watch": "tsup --watch",
|
|
19
|
-
"test": "vitest run",
|
|
20
|
-
"test:watch": "vitest",
|
|
21
|
-
"prepublishOnly": "npm run build",
|
|
22
|
-
"prettier": "prettier -w ."
|
|
23
|
-
},
|
|
24
16
|
"dependencies": {
|
|
25
17
|
"@cloudflare/workers-types": "^4.20250311.0"
|
|
26
18
|
},
|
|
@@ -29,5 +21,12 @@
|
|
|
29
21
|
"tsup": "^8.4.0",
|
|
30
22
|
"typescript": "^5.8.2",
|
|
31
23
|
"vitest": "^3.0.8"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"build:watch": "tsup --watch",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"prettier": "prettier -w ."
|
|
32
31
|
}
|
|
33
|
-
}
|
|
32
|
+
}
|