Skip to main content

elysia-betterauth-oauth

Integrates OAuth 2.1 with PKCE for BetterAuth and Elysia APIs, enabling secure authentication for native desktop and mobile clients.

Install this skill

or
0/100

Security score

The elysia-betterauth-oauth skill was audited on Mar 8, 2026 and we found 32 security issues across 6 threat categories. Review the findings below before installing.

Categories Tested

Security Issues

medium line 333

Template literal with variable interpolation in command context

SourceSKILL.md
333uris.push(`http://${LOOPBACK_HOST}:${port}/callback`);
medium line 741

Template literal with variable interpolation in command context

SourceSKILL.md
741const url = new URL(`${API_BASE_URL}/api/auth/oauth2/authorize`);
medium line 767

Template literal with variable interpolation in command context

SourceSKILL.md
767const response = await fetch(`${API_BASE_URL}/api/auth/oauth2/token`, {
medium line 781

Template literal with variable interpolation in command context

SourceSKILL.md
781throw new Error(`Token exchange failed (${response.status}): ${body}`);
medium line 800

Template literal with variable interpolation in command context

SourceSKILL.md
800const response = await fetch(`${API_BASE_URL}/api/auth/oauth2/token`, {
medium line 812

Template literal with variable interpolation in command context

SourceSKILL.md
812throw new Error(`Token refresh failed (${response.status}): ${body}`);
medium line 830

Template literal with variable interpolation in command context

SourceSKILL.md
830const response = await fetch(`${API_BASE_URL}/api/auth/oauth2/userinfo`, {
medium line 831

Template literal with variable interpolation in command context

SourceSKILL.md
831headers: { Authorization: `Bearer ${accessToken}` },
medium line 834

Template literal with variable interpolation in command context

SourceSKILL.md
834throw new Error(`Userinfo failed (${response.status})`);
medium line 900

Template literal with variable interpolation in command context

SourceSKILL.md
900`http://${LOOPBACK_HOST}:${CALLBACK_PORT_START}`
medium line 913

Template literal with variable interpolation in command context

SourceSKILL.md
913safeReject(new Error(`OAuth error: ${error}`));
medium line 947

Template literal with variable interpolation in command context

SourceSKILL.md
947safeReject(new Error(`Callback server error: ${nodeErr.message}`));
medium line 953

Template literal with variable interpolation in command context

SourceSKILL.md
953`All ports ${CALLBACK_PORT_START}-${CALLBACK_PORT_END} in use`
medium line 982

Template literal with variable interpolation in command context

SourceSKILL.md
982return `http://${LOOPBACK_HOST}:${port}/callback`;
medium line 1136

Template literal with variable interpolation in command context

SourceSKILL.md
1136`${API_BASE_URL}/oauth/revoke-all-sessions`,
medium line 1139

Template literal with variable interpolation in command context

SourceSKILL.md
1139headers: { Authorization: `Bearer ${accessToken}` },
low line 458

Fetch to external URL

SourceSKILL.md
458const res = await fetch('/api/auth/sign-in/email', {
low line 1001

Access to .env file

SourceSKILL.md
1001process.env.NODE_ENV === "development"
medium line 1084

Access to system keychain/keyring

SourceSKILL.md
1084// Store tokens securely (e.g., Electron safeStorage, keychain)
medium line 724

Character code construction - potential obfuscation

SourceSKILL.md
724return btoa(String.fromCharCode(...new Uint8Array(hash)))
low line 71

External URL reference

SourceSKILL.md
714. Receive callback ←──────────────── 302 → http://127.0.0.1:{port}/callback?code=...&state=...
low line 333

External URL reference

SourceSKILL.md
333uris.push(`http://${LOOPBACK_HOST}:${port}/callback`);
low line 550

External URL reference

SourceSKILL.md
550new URL("/api/auth/oauth2/userinfo", "http://localhost"),
low line 591

External URL reference

SourceSKILL.md
591hashing. The `http://localhost` base URL is a dummy — only the path and headers
low line 678

External URL reference

SourceSKILL.md
678jwks_uri: https://your-api.com/api/auth/jwks
low line 900

External URL reference

SourceSKILL.md
900`http://${LOOPBACK_HOST}:${CALLBACK_PORT_START}`
low line 982

External URL reference

SourceSKILL.md
982return `http://${LOOPBACK_HOST}:${port}/callback`;
low line 1186

External URL reference

SourceSKILL.md
1186base URL like `http://127.0.0.1:8789` instead of the dynamic active port. After
low line 1188

External URL reference

SourceSKILL.md
1188would cause `new URL(req.url, 'http://127.0.0.1:null')` which throws
low line 1237

External URL reference

SourceSKILL.md
1237https://better-auth.com/docs/plugins/oauth-provider
low line 1238

External URL reference

SourceSKILL.md
1238- **RFC 7636 (PKCE):** https://tools.ietf.org/html/rfc7636
low line 1239

External URL reference

SourceSKILL.md
1239- **RFC 8252 (OAuth for Native Apps):** https://tools.ietf.org/html/rfc8252
Scanned on Mar 8, 2026
View Security Dashboard