@cloudflare/workers-oauth-provider 0.0.11 → 0.0.12
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 +10 -0
- package/package.json +1 -1
package/dist/oauth-provider.js
CHANGED
|
@@ -1266,6 +1266,16 @@ var OAuthHelpersImpl = class {
|
|
|
1266
1266
|
* @returns A Promise resolving to an object containing the redirect URL
|
|
1267
1267
|
*/
|
|
1268
1268
|
async completeAuthorization(options) {
|
|
1269
|
+
const { clientId, redirectUri } = options.request;
|
|
1270
|
+
if (!clientId || !redirectUri) {
|
|
1271
|
+
throw new Error("Client ID and Redirect URI are required in the authorization request.");
|
|
1272
|
+
}
|
|
1273
|
+
const clientInfo = await this.lookupClient(clientId);
|
|
1274
|
+
if (!clientInfo || !clientInfo.redirectUris.includes(redirectUri)) {
|
|
1275
|
+
throw new Error(
|
|
1276
|
+
"Invalid redirect URI. The redirect URI provided does not match any registered URI for this client."
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1269
1279
|
const grantId = generateRandomString(16);
|
|
1270
1280
|
const { encryptedData, key: encryptionKey } = await encryptProps(options.props);
|
|
1271
1281
|
const now = Math.floor(Date.now() / 1e3);
|