storeapi: decouple auth and API
Metadata
Current evaluation
Merged changes decoupling authentication from API logic. Introduces a centralized Authorization component for token handling and request wrapping, simplifies login primitives, and refactors 24 files. Approved by reviewers, passed CI, and integrated into master.
Suggested action: —
No scores available.
Issue body
This changes includes:
- a new Authorization component to generate requests.
- Auth and token discharge logic tied to Authorization class.
- Refresh logic centralized to the request of the Authorization class
(as it is backend specific).
- Core login primitives simplified in StoreClient and relevant
delegations to the Authorization class.
- A general simple inheritable requests wrapper for each .*API class
with an abstractmethod to implement the request logic.
There is one big change in behavior, internally mostly, is that now
all requests to get_account_information are not stored anymore. This
affects a fast whoami call. This will be added back after the new
candid client is introduced.
Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
This is how it looks like now:

Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged changes decoupling authentication from API logic. Introduces a centralized Authorization component for token handling and request wrapping, simplifies login primitives, and refactors 24 files. Approved by reviewers, passed CI, and integrated into master. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Decouples auth and API logic in storeapi via a centralized Authorization component, centralizing token refresh and adding a base requests wrapper. Removes internal caching of get_account_information requests pending future updates. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master, decoupling auth and API in storeapi. Introduces an Authorization component, centralizes token refresh, and simplifies login. Internal account info caching was removed pending a new client. Coverage reached 94.89%. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3592 storeapi: auth client for api.snapcraft.io | snapcraft | closed | Merged into master. The pull request adds an authentication client for api.snapcraft.io with a single-line change. Codecov reported 100% diff coverage with no overall coverage impact. Closed after successful merge. |