This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

fix

+16 -9
+16 -9
app/src/lib/bluesky-api.ts
··· 275 275 return false; 276 276 } 277 277 278 + // For API calls, use the actual PDS endpoint 279 + // But when we need to do token refresh, use bsky.social for auth on third-party servers 280 + let authServer = pdsEndpoint; 281 + if (!pdsEndpoint.includes('bsky.social')) { 282 + console.log('[AUTH CHECK] Will use bsky.social for OAuth on third-party PDS'); 283 + authServer = 'https://bsky.social'; 284 + } 285 + 278 286 // First check if the token is expired by decoding it 279 287 const tokenExpired = isTokenExpired(accessToken); 280 288 if (tokenExpired && refreshToken) { ··· 306 314 307 315 // For API calls, use the actual PDS endpoint 308 316 const baseUrl = `${pdsEndpoint}/xrpc`; 309 - 310 - // But when we need to do token refresh, use bsky.social for auth on third-party servers 311 - let authServer = pdsEndpoint; 312 - if (!pdsEndpoint.includes('bsky.social')) { 313 - console.log('[AUTH CHECK] Will use bsky.social for OAuth on third-party PDS'); 314 - authServer = 'https://bsky.social'; 315 - } 316 317 317 318 // First, get the user's handle from their DID using repo.describeRepo 318 319 const describeRepoEndpoint = `${baseUrl}/com.atproto.repo.describeRepo`; ··· 393 394 394 395 try { 395 396 // Try to refresh the token with enhanced error handling 396 - // Use authServer for token refresh (bsky.social for third-party PDS) 397 + // Use bsky.social for token refresh with third-party PDS 398 + let refreshAuthServer = pdsEndpoint; 399 + if (!pdsEndpoint.includes('bsky.social')) { 400 + console.log('[AUTH CHECK] Using bsky.social for token refresh with third-party PDS'); 401 + refreshAuthServer = 'https://bsky.social'; 402 + } 403 + 397 404 const { accessToken: newAccessToken, refreshToken: newRefreshToken, dpopNonce: newNonce } = 398 - await refreshAccessToken(refreshToken, keyPair, authServer); 405 + await refreshAccessToken(refreshToken, keyPair, refreshAuthServer); 399 406 400 407 // Update tokens in localStorage 401 408 if (typeof localStorage !== 'undefined') {