Skip to content

Conversation

@reslear
Copy link

@reslear reslear commented Aug 22, 2025

resolve #507
more manual solution instead #509

CleanShot.2025-08-22.at.13.32.11.mp4

demo: https://belongnet.github.io/enoki-vue/wallet


Added ability to disable automatic popup and get URL for manual auth flow management.

Key Changes

1. Extended connect() method

// Old way (with popup)
await wallet.connect();

// New way (without popup)
const { accounts, authorizationUrl, sessionContext } = await wallet.connect({ disablePopup: true });

2. New callback handling feature

const state = await wallet.features['enoki:handleAuthCallback'].handleAuthCallback({
  hash: window.location.hash,
  sessionContext,
  pkceContext,
  search: window.location.search,
});

How It Works

  1. disablePopup: true - disables automatic popup in #createSession()
  2. Returns URL - authorizationUrl for user redirection
  3. Saves context - sessionContext and pkceContext for later processing
  4. Manual handling - user redirects to URL and handles callback manually

Types

  • EnokiConnectMethod - extended connect type with disablePopup
  • EnokiHandleAuthCallbackFeature - callback handling feature
  • EnokiHandleAuthCallbackInput - input for handleAuthCallback

Backward Compatibility

✅ Full backward compatibility - old connect() continues to work as before

Usage Example

// 1. Create session without popup
const { authorizationUrl, sessionContext, pkceContext } = await wallet.connect({ disablePopup: true });

// 2. Parse authorizationUrl nonce 

// 3. Use native window with auth and get idToken

// 3. Handle callback
const state = await wallet.features['enoki:handleAuthCallback'].handleAuthCallback({
  hash: `#id_token=${idToken}`,
  sessionContext,
  pkceContext,
  search: '',
});

@reslear reslear requested a review from a team as a code owner August 22, 2025 10:06
@vercel
Copy link

vercel bot commented Aug 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sui-typescript-docs Ready Ready Preview Comment Nov 14, 2025 7:58pm

@reslear
Copy link
Author

reslear commented Aug 22, 2025

hi @williamrobertson13 @pchrysochoidis could you do a review and suggest improvements ?

@williamrobertson13 williamrobertson13 self-requested a review August 28, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enoki-connect] feature request: enoki popup less option

1 participant