Skip to content

Conversation

@victorvhs017
Copy link
Contributor

@victorvhs017 victorvhs017 commented Nov 27, 2025

This PR adds token auth support for the Python SDK.

This is valid for machine identity tokens and user tokens.

Test it using the method:

client.auth.token_auth.login(token="<your-token>")

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 27, 2025

Greptile Overview

Greptile Summary

Added TokenAuth class providing direct token-based authentication for the Python SDK. This enables users to authenticate using pre-existing machine identity tokens or user JWT tokens via client.auth.token_auth.login(token).

  • New TokenAuth class added to infisical_sdk/resources/auth_methods/token_auth.py with a simple login method that sets the token directly
  • Auth class updated to include token_auth as an authentication option
  • Unlike other auth methods that make API calls to exchange credentials for tokens, this method directly sets the provided token without server-side validation
  • Note: The return type (str) differs from other auth methods which return MachineIdentityLoginResponse - this is intentional since no API call is made

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - adds a simple authentication wrapper with no complex logic
  • Score reflects straightforward implementation following existing patterns. Minor style suggestion about unused parameter, but no functional or security issues identified.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
infisical_sdk/resources/auth_methods/token_auth.py 4/5 New TokenAuth class for direct token authentication. The requests parameter is stored but unused.
infisical_sdk/resources/auth.py 5/5 Added TokenAuth import and instantiation in the Auth class, following existing patterns.
infisical_sdk/resources/auth_methods/init.py 5/5 Added TokenAuth to module exports.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@varonix0 varonix0 merged commit bf1aaf1 into main Nov 27, 2025
9 checks passed
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.

3 participants