Skip to content

Commit 8b9c16b

Browse files
committed
docs: update README with accurate PKCE method names
1 parent 8d3f693 commit 8b9c16b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,22 @@ import { WorkOS } from '@workos-inc/node';
4646

4747
const workos = new WorkOS({ clientId: 'client_...' }); // No API key needed
4848

49-
// These methods work without an API key:
50-
// - workos.userManagement.getAuthorizationUrl() with PKCE
51-
// - workos.userManagement.authenticateWithCodeAndVerifier()
52-
// - workos.userManagement.authenticateWithRefreshToken()
49+
// Generate auth URL with automatic PKCE
50+
const { url, codeVerifier } = await workos.userManagement.getAuthorizationUrlWithPKCE({
51+
provider: 'authkit',
52+
redirectUri: 'myapp://callback',
53+
clientId: 'client_...',
54+
});
55+
56+
// After user authenticates, exchange code for tokens
57+
const { accessToken, refreshToken } = await workos.userManagement.authenticateWithCode({
58+
code: authorizationCode,
59+
codeVerifier,
60+
clientId: 'client_...',
61+
});
5362
```
5463

55-
Use PKCE (Proof Key for Code Exchange) for secure auth code exchange. See the [AuthKit documentation](https://workos.com/docs/authkit) for details.
64+
See the [AuthKit documentation](https://workos.com/docs/authkit) for details on PKCE authentication.
5665

5766
## SDK Versioning
5867

0 commit comments

Comments
 (0)