diff --git a/package.json b/package.json index 1cf6ff9..4e0ba2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vectorize-io/vectorize-connect", - "version": "0.3.7", + "version": "0.4.0", "description": "A simple package for Google Drive authorization and file selection", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/src/baseOAuth/core/oauth.ts b/src/baseOAuth/core/oauth.ts index a300df8..158c163 100644 --- a/src/baseOAuth/core/oauth.ts +++ b/src/baseOAuth/core/oauth.ts @@ -110,9 +110,10 @@ export abstract class BaseOAuth { /** * Create an error response for the OAuth callback * @param error The error to include in the response + * @param nonce Optional nonce for Content Security Policy * @returns A Response object with the error */ - protected static createErrorResponse(error: OAuthError): Response { + protected static createErrorResponse(error: OAuthError, nonce?: string): Response { const htmlContent = ` @@ -122,7 +123,7 @@ export abstract class BaseOAuth { body { font-family: Arial, sans-serif; text-align: center; margin-top: 50px; } .error { color: #f44336; } - - + + `; // Assemble the complete HTML diff --git a/src/googleDriveOAuth/utils/validation.ts b/src/googleDriveOAuth/utils/validation.ts index 6832ba3..d9c1264 100644 --- a/src/googleDriveOAuth/utils/validation.ts +++ b/src/googleDriveOAuth/utils/validation.ts @@ -23,9 +23,10 @@ export function validateConfig(config: OAuthConfig): void { /** * Creates an HTML error response for the OAuth popup * @param error The error to embed in the response + * @param nonce Optional nonce for Content Security Policy * @returns A Response object with the error handling HTML */ -export function createErrorResponse(error: OAuthError): Response { +export function createErrorResponse(error: OAuthError, nonce?: string): Response { // Create a plain object with all properties we want to transfer const errorData = { message: error.message, @@ -35,7 +36,7 @@ export function createErrorResponse(error: OAuthError): Response { }; return new Response( - `