Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@atproto/api] resumeSession while already logged in sends request to currently logged in user's PDS, rather than bsky.social #1964

Open
mozzius opened this issue Dec 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@mozzius
Copy link
Member

mozzius commented Dec 13, 2023

Describe the bug

For the account switch mechanism, I want to reuse the same agent, so I have been calling resumeSession on an already authenticated agent. However, post-federation, the service gets switched out to the currently logged in user's PDS after authentication, so futher authentication requests fail if you're not on the same PDS (shroommates?). I think it would make sense that when making authencation-related requests, it should use the originally passed service URL.

To Reproduce

Steps to reproduce the behavior:

  1. Log in
  2. Try to resumeSession with an account on a different PDS

Request is sent to the PDS of the original account, you should get Token could not be verified

Expected behavior

Request is sent to bsky.social or whatever it's been set to.

@mozzius mozzius added the bug Something isn't working label Dec 13, 2023
@mozzius mozzius changed the title [@atproto/api] resumeSession while already logged in sends request to PDS, rather than bsky.social [@atproto/api] resumeSession while already logged in sends request to currently logged in user's PDS, rather than bsky.social Dec 13, 2023
@mozzius
Copy link
Member Author

mozzius commented Dec 13, 2023

Simple workaround, in case anyone else runs into this:

// reset service uri
agent.api.xrpc.uri = new URL("https://bsky.social");
const res = await agent.resumeSession(session);

@snarfed
Copy link
Contributor

snarfed commented Jan 8, 2024

Dupe of #1848?

@mozzius
Copy link
Member Author

mozzius commented Jan 8, 2024

Dupe of #1848?

Oh seems to be related, although weirdly the exact opposite problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants