{"id":18670,"library":"poe-oauth","title":"poe-oauth","description":"OAuth client and auth verification for the Poe API (v0.0.6). Provides PKCE-based OAuth flow with local callback server and API key validation. Ships TypeScript types. Release cadence: active development within the poe-code monorepo (v3.x branch). Differentiators: minimal dependencies, built-in landing page customization, and keyless identity verification via checkAuth. No alternative standalone packages exist for Poe OAuth.","status":"active","version":"0.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/poe-platform/poe-code","tags":["javascript","typescript"],"install":[{"cmd":"npm install poe-oauth","lang":"bash","label":"npm"},{"cmd":"yarn add poe-oauth","lang":"bash","label":"yarn"},{"cmd":"pnpm add poe-oauth","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; package has no CJS export.","wrong":"const createOAuthClient = require('poe-oauth')","symbol":"createOAuthClient","correct":"import { createOAuthClient } from 'poe-oauth'"},{"note":"Named export, not default.","wrong":"import checkAuth from 'poe-oauth'","symbol":"checkAuth","correct":"import { checkAuth } from 'poe-oauth'"},{"note":"TypeScript type; not a runtime value.","wrong":"const { OAuthResult } = require('poe-oauth')","symbol":"type OAuthResult","correct":"import type { OAuthResult } from 'poe-oauth'"}],"quickstart":{"code":"import { createOAuthClient, checkAuth } from 'poe-oauth';\n\n// Start OAuth flow\nconst client = createOAuthClient({\n  clientId: process.env.POE_CLIENT_ID ?? '',\n  openBrowser: async (url) => { console.log('Open:', url); },\n  readLine: async () => { return prompt('Paste token:') ?? ''; }\n});\n\nconst authorization = await client.authorize();\nconsole.log('Authorization URL:', authorization.authorizationUrl);\nconst result = await authorization.waitForResult();\nconsole.log('API Key:', result.apiKey);\n\n// Verify token\nconst identity = await checkAuth({ apiKey: result.apiKey });\nconsole.log('Identity:', identity);","lang":"typescript","description":"Demonstrates full OAuth flow: creating client, authorizing, waiting for callback, and verifying the API key."},"warnings":[{"fix":"Always provide both callbacks, even if one is a no-op for your use case.","message":"The OAuth client requires both openBrowser and readLine callbacks; providing only one will cause authorize() to hang.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"If overriding one endpoint, override both to avoid mismatched flow.","message":"Default endpoints point to poe.com and api.poe.com; using custom endpoints requires both authorizationEndpoint and tokenEndpoint to be set together.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use await client.authorize().waitForResult() instead of awaiting client.authorize() directly.","message":"The authorize() method returns an object with waitForResult(); using an older pattern that expects a direct promise is now deprecated.","severity":"deprecated","affected_versions":"<0.0.5"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"import { createOAuthClient } from 'poe-oauth'","cause":"Importing default instead of named export.","error":"TypeError: client.authorize is not a function"},{"fix":"npm install poe-oauth and use ESM (import syntax).","cause":"Package not installed or not in CJS context.","error":"Error: Cannot find module 'poe-oauth'"},{"fix":"Provide an async function that returns a string for readLine.","cause":"readLine callback not provided or not async.","error":"TypeError: a.readLine is not a function"},{"fix":"Ensure the token URL is called with the correct code_verifier; avoid modifying the authorization code.","cause":"Mismatched code_verifier caused by network interception or manual token paste.","error":"Error: PKCE verification failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}