Skip to content

Issue with getSite and auth #194

@tgxn

Description

@tgxn

Previously, I was passing auth to getSite() in order to fetch the current user and their metadata.

It looks like the formData param has been removed:
ab7af88#r128832008

Is there an alternative way to pass auth in?

example code

const lemmyClient = new LemmyHttp(`https://${instanceBase}`);

const auth = await lemmyClient.login({
  username_or_email: username,
  password: password,
});

// as long aws there is a JWT in the response from login, logged in!
if (auth.jwt) {

  // this shows the `jwt` is present 👍
  console.log("auth", auth);

  // i tried this too, but didn't seem to work :/
  lemmyClient.setHeaders({
    Cookie:	`jwt=${auth.jwt}`
  });

  // this no longer has any params
  const getSite = await lemmyClient.getSite({
    auth: auth.jwt,
  });

  // but never any user data here :(
  console.log("getSite", getSite);
}   

Edit: forgot to mention, this was after upgrading to 0.19.0-rc.13 from 0.18.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions