Skip to content

Commit 92c0a70

Browse files
fix: correct socialExchange description and add null guards to example
Generated-By: mintlify-agent
1 parent bcfa27c commit 92c0a70

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎mintlify/docs/sdk/auth.mdx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ socialStart(provider: 'github' | 'google'): string
120120

121121
### socialExchange
122122

123-
Exchange the `rtCode` received at your callback URL for a session.
123+
Exchange the `rtCode` received at your callback URL for a refresh token.
124124

125125
```typescript
126126
socialExchange(payload: SocialExchangePayload): Promise<SocialExchangeResponse>
@@ -134,6 +134,10 @@ const urlParams = new URLSearchParams(window.location.search);
134134
const rtCode = urlParams.get('rtCode');
135135
const token = new URLSearchParams(window.location.hash.slice(1)).get('token');
136136

137+
if (!rtCode || !token) {
138+
throw new Error('Missing OAuth callback parameters');
139+
}
140+
137141
const { refreshToken } = await client.auth.socialExchange({ token, rtCode });
138142
```
139143

0 commit comments

Comments
 (0)