@@ -429,11 +429,6 @@ export function useConnectionValue() {
429429 return ;
430430 }
431431
432- if ( ! configData . origin ) {
433- setVerified ( false ) ;
434- return ;
435- }
436-
437432 const allowedOrigins = toArray ( configData . origin as string | string [ ] ) ;
438433
439434 // In standalone mode (not iframe), verify preset if redirect_url matches preset whitelist
@@ -446,8 +441,10 @@ export function useConnectionValue() {
446441 const redirectUrlObj = new URL ( redirectUrl ) ;
447442 const redirectOrigin = redirectUrlObj . origin ;
448443
449- // Always consider localhost as verified for development
450- const isLocalhost = redirectOrigin . includes ( "localhost" ) ;
444+ // Always consider localhost and capacitor as verified for development
445+ const isLocalhost =
446+ redirectOrigin . includes ( "localhost" ) ||
447+ redirectOrigin . startsWith ( "capacitor://" ) ;
451448 const isOriginAllowed = isOriginVerified (
452449 redirectOrigin ,
453450 allowedOrigins ,
@@ -466,10 +463,16 @@ export function useConnectionValue() {
466463 return ;
467464 }
468465
466+ if ( ! configData . origin ) {
467+ setVerified ( false ) ;
468+ return ;
469+ }
470+
469471 // Embedded mode: verify against parent origin
470- // Always consider localhost as verified for development (not 127.0.0.1)
472+ // Always consider localhost and capacitor as verified for development (not 127.0.0.1)
471473 if ( origin ) {
472- const isLocalhost = origin . includes ( "localhost" ) ;
474+ const isLocalhost =
475+ origin . includes ( "localhost" ) || origin . startsWith ( "capacitor://" ) ;
473476 const isOriginAllowed = isOriginVerified ( origin , allowedOrigins ) ;
474477 const finalVerified = isLocalhost || isOriginAllowed ;
475478 setVerified ( finalVerified ) ;
@@ -839,6 +842,11 @@ export function isOriginVerified(
839842 const currentHostname = originUrl . hostname ;
840843
841844 return allowedOrigins . some ( ( allowedOrigin ) => {
845+ // Check for exact origin match (including scheme)
846+ if ( origin === allowedOrigin || originUrl . origin === allowedOrigin ) {
847+ return true ;
848+ }
849+
842850 // Check for wildcard subdomain matching
843851 if ( allowedOrigin . startsWith ( "*." ) ) {
844852 const baseDomain = allowedOrigin . substring ( 2 ) ;
0 commit comments