After getting a LoginResponse from the Lemmy API, it returns an auth JWT token.

I’m trying to figure out how I can get that users person_id or username so I can make a GetPersonDetails request for the currently logged in user.

Any ideas on how to do this?

  • PicoBlaanket
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    Successful Login automatically initiates a GetSite operation, which contains person_id:

    op.data.my_user.local_user_view.local_user.person_id

    and username:

    op.data.my_user.local_user_view.person.name

    That will do it.

  • Slated@vlemmy.net
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    1 year ago

    You’ll want to save the JWT and then use it as the auth parameter for GetPersonDetails

      • Slated@vlemmy.net
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Oh strange I would assume you would want to either include the id or the username, whatever the documentation asks for. You can also always just use the GetSite endpoint and GetSiteResponse.my_user

    • Charlie Fish@eventfrontier.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I was looking at that, but it didn’t seem to be the person_id of my user.

      It looks like maybe local_user_id is different than person_id?