Samriddhi Sinha
11/29/2025, 5:41 PMsdk.oauth.start('google', redirectUrl) returns 200 with Google authorization URL
3. ✅ User redirected to Google OAuth consent screen
4. ✅ User authorizes and Google redirects back with authorization code
5. ❌ sdk.oauth.exchange(window.location.href) returns 401 Unauthorized with error E061301
Configuration:
In Descope Console (Authentication Methods → Social Login → Google):
- Google OAuth is enabled
- Client ID: [redacted].apps.googleusercontent.com`
- Client Secret: Verified and matches Google Cloud Console exactly
- Redirect URLs configured: https://[my-domain].com/login
In Google Cloud Console:
- Application type: Web application
- Authorized redirect URIs: https://api.descope.com/v1/oauth/callback
- Authorized JavaScript origins: https://[my-domain].com
- OAuth consent screen: External, scopes include email, profile, openid
- Status: Testing (my email added as test user)
Error Response:
{
"code": 401,
"ok": false,
"error": {
"errorCode": "E061301",
"errorDescription": "Failed to exchange token",
"errorMessage": "Failed exchanging sso token"
}
}
SDK Implementation:
// Start OAuth
const result = await sdk.oauth.start('google', 'https://[my-domain].com/login');
// Redirects successfully
// Exchange (after redirect back)
const exchangeResult = await sdk.oauth.exchange(window.location.href);
// Returns E061301 error
Verified:
- ✅ Client ID and Secret are correct and match exactly
- ✅ Descope's callback URL (https://api.descope.com/v1/oauth/callback) is in Google's authorized redirect URIs
- ✅ My app's redirect URL is configured in Descope
- ✅ Google+ API is enabled
- ✅ Waited several minutes after configuration changes
- ✅ OTP authentication (email/SMS) works correctly with the same project
Question: What could cause E061301 specifically? Is there additional configuration needed in Descope for Google OAuth, or are there logs I can check to see the actual error from Google's token endpoint?
Descope SDK version: @descope/web-js-sdk@latest (from unpkg CDN)Meir Wahnon
11/29/2025, 6:18 PMSamriddhi Sinha
11/29/2025, 7:22 PMMeir Wahnon
11/29/2025, 7:31 PMMeir Wahnon
11/29/2025, 7:31 PMsdk.oauth.exchange(window.location.href);
here , you should provide code you got from sdk.oauth.start result , specifically result.codeMeir Wahnon
11/29/2025, 7:31 PMSamriddhi Sinha
11/29/2025, 7:56 PM