Verify_credentials -- I'm doing something wrong here

(Is there a better place to ask questions about compliance?)

I’m testing how Tusky responds to kepi, and something seems to be wrong with the way kepi implements verify_credentials. kepi’s response in the presenting case is

{
  "id": "@marnanel",
  "username": "marnanel",
  "acct": "@marnanel@sandy-heath.thurman.org.uk",
  "display_name": "marnanel",
  "locked": false,
  "avatar": "https://sandy-heath.thurman.org.uk/static/defaults/avatar_9.jpg",
  "header": "https://sandy-heath.thurman.org.uk/static/defaults/header.jpg",
  "created_at": "2019-12-25T23:51:03.882335Z",
  "followers_count": 0,
  "following_count": 0,
  "statuses_count": 0,
  "note": "",
  "url": "https://sandy-heath.thurman.org.uk/users/marnanel",
  "avatar_static": "https://sandy-heath.thurman.org.uk/static/defaults/avatar_9.jpg",
  "header_static": "https://sandy-heath.thurman.org.uk/static/defaults/header.jpg",
  "moved_to": null,
  "fields": [],
  "emojis": [],
  "bot": false,
  "source": {
    "privacy": "public",
    "sensitive": false,
    "note": "",
    "language": "en"
  }
}

whereupon Tusky crashes. adb logcat shows the exception

java.lang.NullPointerException: Attempt to invoke interface method 'int java.lang.CharSequence.length()' on a null object reference
    at com.keylesspalace.tusky.entity.Account.getName(SourceFile:1)

which is here and is checking display_name for zero length. But display_name is not null in what I sent. Is there something else obviously wrong in what I’m sending, or is this something I should be asking the Tusky devs about?

I think this topic would be better for the mastodon forum, since it’s masto API specific. for now I’m going to move it to the mastodon category on this forum, but it might be better suited for another forum. I don’t want to give the impression that the mastodon API is a “de-facto” client to server standard, since it’s very poorly suited for that purpose, and is very tightly coupled to the specifics of mastodon’s design.

2 Likes

one thing i’m noticing is that acct should not include the leading @ symbol. the acct: URI takes the form of username for local users and username@domain for remote users.

the other thing is that the id is a string that does not correspond to a number. you’ll have to check with tusky devs about this (and i suspect other clients), but it wouldn’t be the first time client devs have made technically incorrect assumptions here. ID is always a string, and although it is cast from a number, it is not guaranteed to be one; however, mastodon uses 64-bit integers as base10, and pleroma uses 128-bit flake ids as base62. since these two softwares are the primary providers of the mastodon api, there haven’t been any counterexamples to break the assumption that id should at least represent a number (for sortability purposes, e.g.).

1 Like

thank you! that’s very helpful.

1 Like