Skip to content

feat: JSON output from login with token capture#10

Merged
Saturate merged 4 commits into
mainfrom
feat/login-json-output
Apr 10, 2026
Merged

feat: JSON output from login with token capture#10
Saturate merged 4 commits into
mainfrom
feat/login-json-output

Conversation

@Saturate
Copy link
Copy Markdown
Owner

@Saturate Saturate commented Apr 10, 2026

Summary

Closes #8

  • mitid login now outputs structured JSON to stdout with cookies, body (when JSON), finalUrl, and provider
  • Progress messages moved to stderr so piping works cleanly: mitid login user url | jq '.body.access_token'
  • Services returning tokens as a JSON response body (e.g. access_token, refresh_token) are now captured in the body field
  • Removed auto-clipboard from login — pipe to pbcopy/xclip instead
  • Updated README and guide with new output format and jq examples

Example output

{
  "provider": "Criipto",
  "finalUrl": "https://service.example.com/callback",
  "cookies": { "session": "abc123" },
  "body": { "access_token": "eyJ...", "refresh_token": "..." }
}

Breaking changes

  • mitid login stdout is now JSON (was human-readable text with truncated cookies)
  • No longer auto-copies to clipboard
  • LoginResult type now includes body: string

login command now outputs structured JSON to stdout with cookies,
response body (when JSON), finalUrl, and provider. Progress messages
go to stderr so piping works cleanly (e.g. | jq '.body.access_token').

Services returning tokens as JSON body instead of cookies are now
captured in the output.

Closes #8
Body is now always present — parsed as JSON when possible, raw string
otherwise. No data is lost regardless of response content type.
- Remove unused private userId field in MitIDClient
- Update README to reflect body is always present
@Saturate Saturate merged commit 1a84eac into main Apr 10, 2026
2 checks passed
@Saturate Saturate deleted the feat/login-json-output branch April 10, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output access tokens from JSON callback responses

1 participant