Test the @std/oauth library using Playwright MCP tools.
- Val Town MCP server access
- Playwright MCP tools (
mcp__playwright__*) - Test email:
stevekrouse-6ca82204b4fa11f0ad790224a6c84d84@valtown.email - Login link retrieval: Use
@stevekrouse/login-to-val-town-shimval
The example app runs at the endpoint URL for example.tsx in the std/oauth val.
Use Val Town MCP to get it:
mcp__val-town__list_files({
val: "std/oauth"
});
Look for example.tsx in the results - the endpoint URL in its links object is the demo URL (typically https://std--[id].web.val.run).
If not already logged in to Val Town in the browser:
-
Navigate to sign-in:
mcp__playwright__browser_navigate({ url: "https://www.val.town/auth/signin/" }); -
Enter test email and click Continue
-
Retrieve login link from SQLite:
mcp__val-town__sqlite_execute({ sql: "SELECT text, timestamp FROM login_to_val_town_shim_emails ORDER BY timestamp DESC LIMIT 1" }); -
Extract the
https://clerk.val.town/v1/verify?...URL from the email text -
Navigate to login URL to complete sign-in
mcp__playwright__browser_navigate({
url: "https://std--91178458b42e11f0b6f30224a6c84d84.web.val.run"
});
Expected: Page shows "Not logged in" with "Log in" link
mcp__playwright__browser_click({
element: "Log in link",
ref: "[ref from snapshot]"
});
Expected: Redirects to Val Town OAuth authorization page showing requested permissions
mcp__playwright__browser_click({
element: "Allow button",
ref: "[ref from snapshot]"
});
Expected:
- Redirects back to demo app
- Shows "Logged in as: steve_test_claude_code"
- Shows User ID
Refresh or navigate to home again - should still be logged in.
mcp__playwright__browser_click({
element: "Log out link",
ref: "[ref from snapshot]"
});
Expected: Returns to "Not logged in" state
- OAuth authorization code flow with PKCE
- Dynamic client registration
- Session cookie creation with encrypted data
- Username fetched from
/v1/meAPI - Session persistence across requests
- Logout functionality
The default scopes include:
openid- Basic OpenID Connectoffline_access- Refresh tokenprofile- Profile informationuser_r- Read user datauser_rw- Write user data (needed for/v1/meaccess)