[Bug]: Optional-auth queries never send authorization, so `viewer` is always missing even with an active session

Open Beginner friendly
#352 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
swift
Domain
api

Research direction

Start with searchActors(matching:limit:cursor:) and compare its request setup with the optional-auth methods named in the issue: getAuthorFeed, getListFeed, searchStarterPacks, and getLabelerServices. Check how getUserSession() is used to attach authorization while still allowing unauthenticated requests. Done when viewer is populated for followed accounts with an active session and these queries still work without one.

Written by the indexing model from the issue text.

Description

bug
Summary

searchActors(matching:limit:cursor:) always sends its request to self.pdsURL without authorization, even when a user session exists, so viewer is always missing on the returned actors. Other optional-auth methods such as getAuthorFeed, getListFeed, searchStarterPacks, and getLabelerServices have the same problem.

Reproduction Steps
  1. Sign in with ATProtoKit so that getUserSession() returns a session.
  2. Call searchActors(matching:) with a query that matches an account the signed-in user follows.
  3. Inspect viewer on the returned actors.
Expected Results

viewer is populated (e.g. viewer.followingURI for followed accounts).

Actual Results

viewer is nil for every actor.

What operating systems did you experience this bug?

macOS

Operating System Version

macOS Golden Gate 27.2.1

ATProtoKit Version

0.34.1

Additional Context

The lexicons state "Does not require auth," which permits unauthenticated calls but does not preclude authenticated ones.

Dominant language
Swift
Stars
226
Forks
40
Avg merge
2h 56m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MasterJ93/ATProtoKit

All issues in MasterJ93/ATProtoKit

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.