Explain how to generate a bearer token
Opened this issue · 2 comments
Explain how to generate a bearer token here: https://www.docs.bsky.app/docs/api/at-protocol-xrpc-api or update endpoints to publicly accessible ones that don't require bearer tokens
This is huge - the ability to call the api right from the docs is great but there is no obvious docs for how to get the bearer token that enables this for much of the api.
💯 agree with this issue 👍
What I discover from community examples (example) is that the api seems directly available from agent.api
scope,
Out of error this not appears in the doc or else I completely miss that point (that is possible :p).
Here is a simple example on how to call getPreferences()
api without having to deal with token.
// service, loginOptions
const agent = new BskyAgent({service})
agent.login(loginOptions);
const response = await this.agent.api.app.bsky.actor.getPreferences();
console.log(`response`, JSON.stringify(response, null, 2));
It would be great to have at least a little trigger like this in http reference introduction
(+ of course explain how to get bearer token from agent : seems to be loginResponse::accessJwt
)