Skip to content

fix: update login to /auth2/login endpoint#230

Merged
Olen merged 5 commits into
mainfrom
fix/login-auth2-endpoint
May 14, 2026
Merged

fix: update login to /auth2/login endpoint#230
Olen merged 5 commits into
mainfrom
fix/login-auth2-endpoint

Conversation

@Olen

@Olen Olen commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Spond replaced https://api.spond.com/core/v1/login with https://api.spond.com/core/v1/auth2/login on 2026-05-13, breaking all calls (issue login() fails with 404 — https://api.spond.com/core/v1/login no longer responding #229).
  • The new response wraps the bearer token under accessToken.token (with an ISO expiration) instead of a flat loginToken string.
  • Token extraction factored into a static helper so a future refresh-token path can reuse the parser without restructuring login(). Public API (self.token, auth_headers, login() signature) is unchanged.

Test plan

  • New TestLogin class adds the first test coverage for login() — happy path + error-response path + parametrized unit tests on the parser
  • pytest — 21 passed (8 new)
  • ruff check — clean
  • Manual smoke test: run an example against a real account (reviewer to confirm)

Closes #229

🤖 Generated with Claude Code

Spond replaced /core/v1/login with /core/v1/auth2/login on 2026-05-13.
The new response wraps the bearer token under accessToken.token (with an
explicit expiration) instead of a flat loginToken string. Public API
unchanged: self.token still holds the bearer string and auth_headers
still produces the same Authorization header.

Adds the first test coverage for login() and parses defensively so
error-shaped responses ({"error": ...}, null accessToken, empty token)
all surface as AuthenticationError with the raw response in the message.

Closes #229

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Spond login flow to use the new /core/v1/auth2/login endpoint and parses the new response shape (accessToken.token) rather than the old flat loginToken. Token extraction is factored into a reusable static helper, and tests are added for login() and the parser.

Changes:

  • Switch login() URL to auth2/login and read the bearer token from accessToken.token.
  • Extract token-parsing logic into _SpondBase._extract_access_token, raising AuthenticationError for any unexpected shape.
  • Add TestLogin covering happy path, error response, and parametrized parser cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
spond/base.py Updates login URL and refactors token extraction into a static helper that validates the new response structure.
tests/test_spond.py Adds first test coverage for login() and the new _extract_access_token parser.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Olen Olen added the updateme Automatically update PR from main label May 14, 2026
@Olen Olen merged commit 398db9f into main May 14, 2026
8 checks passed
@Olen Olen deleted the fix/login-auth2-endpoint branch May 14, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

updateme Automatically update PR from main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

login() fails with 404 — https://api.spond.com/core/v1/login no longer responding

2 participants