Skip to content

Add --raw flag to output unmodified JSON token response#149

Closed
dcluna wants to merge 1 commit intoSecureAuthCorp:masterfrom
dcluna:print-raw-json
Closed

Add --raw flag to output unmodified JSON token response#149
dcluna wants to merge 1 commit intoSecureAuthCorp:masterfrom
dcluna:print-raw-json

Conversation

@dcluna
Copy link
Copy Markdown

@dcluna dcluna commented Apr 28, 2026

Preserves the raw JSON bytes from the token endpoint response so that fields not modeled in TokenResponse (e.g. email, environment_id, legal_entity_name) are available when --raw is passed.

My use case for this is that one of the OAuth providers I work with returns some data in the response that is important for my application, for example, in this payload:

{
    "access_token": "token",
    "email": "me@email.com",
    "environment_id": "envid-token-here",
    "environment_name": "oauth environment",
    "expires_in": 3600,
    "family_name": "Smith",
    "given_name": "John",
    "legal_entity_id": "legal-entity-id-token-here",
    "legal_entity_name": "oauth environment provider",
    "mode": "None",
    "refresh_token": "ref-token",
    "refresh_token_expires_in": 31536000,
    "token_type": "Bearer",
    "user_id": "uid-token-here"
  }

The environment and legal_entity fields are important for my application, and they should be retrieved from this endpoint.

I'll understand if there are other concerns (I assume security must be one of them) for not including this in the CLI, but just wanted to float the idea and see the feedback.

Preserves the raw JSON bytes from the token endpoint response so that
fields not modeled in TokenResponse (e.g. email, environment_id,
legal_entity_name) are available when --raw is passed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mbilski
Copy link
Copy Markdown
Contributor

mbilski commented Apr 28, 2026

Thanks for the patch. Would #150 work for you instead? It keeps the unknown fields but doesn't require a --raw flag.

@dcluna
Copy link
Copy Markdown
Author

dcluna commented Apr 28, 2026

Thanks for the patch. Would #150 work for you instead? It keeps the unknown fields but doesn't require a --raw flag.

@mbilski Thanks, I just tested it and it does what I expect, and does not require an extra flag. Would prefer that approach. I'll close this in favor of that PR, thanks for the quick turnaround.

@dcluna dcluna closed this Apr 28, 2026
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.

2 participants