Skip to content

How to get the information of the user only by instance and token? #1077

Answered by neet
maodaisuki asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @maodaisuki, You may want /api/v1/accounts/verify_credentials. See the documentation below:
https://docs.joinmastodon.org/methods/accounts/#verify_credentials

The corresponding API for it in Masto.js is masto.v1.accounts.verifyCredentials()

it("verifies credential", async () => {
await using session = await sessions.acquire();
const me = await session.rest.v1.accounts.verifyCredentials();
expect(me.username).not.toBeNull();
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maodaisuki
Comment options

Answer selected by maodaisuki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants