@payez/next-mvp 4.0.11 → 4.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/better-auth.js +12 -4
- package/package.json +1 -1
- package/src/auth/better-auth.ts +8 -4
package/dist/auth/better-auth.js
CHANGED
|
@@ -140,14 +140,22 @@ function createBetterAuthInstance(idpConfig) {
|
|
|
140
140
|
client_id: idpConfig.clientSlug || String(idpConfig.clientId),
|
|
141
141
|
}),
|
|
142
142
|
});
|
|
143
|
+
const oauthResText = await oauthRes.text();
|
|
144
|
+
console.log('[BETTER_AUTH] IDP oauth-callback response:', oauthRes.status, oauthResText.substring(0, 500));
|
|
143
145
|
if (!oauthRes.ok) {
|
|
144
|
-
console.error('[BETTER_AUTH] IDP oauth-callback failed:', oauthRes.status
|
|
146
|
+
console.error('[BETTER_AUTH] IDP oauth-callback failed:', oauthRes.status);
|
|
145
147
|
return;
|
|
146
148
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
let idpData;
|
|
150
|
+
try {
|
|
151
|
+
idpData = JSON.parse(oauthResText);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const result = idpData?.data?.result || idpData?.data || idpData;
|
|
149
157
|
if (!result?.access_token) {
|
|
150
|
-
console.warn('[BETTER_AUTH] IDP oauth-callback returned no access_token');
|
|
158
|
+
console.warn('[BETTER_AUTH] IDP oauth-callback returned no access_token. Keys:', Object.keys(result || {}));
|
|
151
159
|
return;
|
|
152
160
|
}
|
|
153
161
|
// Store IDP tokens in the BA Redis session
|
package/package.json
CHANGED
package/src/auth/better-auth.ts
CHANGED
|
@@ -153,16 +153,20 @@ export function createBetterAuthInstance(idpConfig: IDPClientConfig) {
|
|
|
153
153
|
}),
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
const oauthResText = await oauthRes.text();
|
|
157
|
+
console.log('[BETTER_AUTH] IDP oauth-callback response:', oauthRes.status, oauthResText.substring(0, 500));
|
|
158
|
+
|
|
156
159
|
if (!oauthRes.ok) {
|
|
157
|
-
console.error('[BETTER_AUTH] IDP oauth-callback failed:', oauthRes.status
|
|
160
|
+
console.error('[BETTER_AUTH] IDP oauth-callback failed:', oauthRes.status);
|
|
158
161
|
return;
|
|
159
162
|
}
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
let idpData: any;
|
|
165
|
+
try { idpData = JSON.parse(oauthResText); } catch { return; }
|
|
166
|
+
const result = idpData?.data?.result || idpData?.data || idpData;
|
|
163
167
|
|
|
164
168
|
if (!result?.access_token) {
|
|
165
|
-
console.warn('[BETTER_AUTH] IDP oauth-callback returned no access_token');
|
|
169
|
+
console.warn('[BETTER_AUTH] IDP oauth-callback returned no access_token. Keys:', Object.keys(result || {}));
|
|
166
170
|
return;
|
|
167
171
|
}
|
|
168
172
|
|