Skip to main content

A cli for managing Graph API tokens

Project description

gts (graph-token-store)

gts is a CLI for authenticating to Microsoft Graph and managing the resulting tokens

Overview

The cli (gts) provides the following features (and more!):

  • Status command to identify the current signed-in user, application in-use, and scopes provided by that application (status)
  • Alises for useful first-party Microsoft clients (aliases)
  • Print an access or refresh token from the OS keyring for a specific client (via the client id) to pass to another tool (AAD-Internals, RoadTools etc) (dump)
  • FOCI client login similar to Invoke-RefreshTo<X> commands provided by TokenTactics (refresh-to)
  • Store and use an access or refresh token sourced outside gts(insert)
  • Switch between applications with valid access tokens (switch)
  • Enumerate some basic tenant information (enum)

Install

uv tool install graph-token-store

Quickstart

$> gts

 Usage: gts [OPTIONS] COMMAND [ARGS]...

 A cli for managing Graph API tokens

╭─ Options ────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────╮
│ login       Authenticate and store the resulting token(s), setting the active identity.  │
│ logout      Remove the active identity (or all) from the cache and clear active state.   │
│ status      Show the active identity, client, tenant, and scopes.                        │
│ switch      Switch the active identity. With no client id, pick from an interactive menu.│
│ aliases     List first-party client aliases.                                             │
│ list        List all cached user client applications.                                    │
│ list-sps    List all cached service principals.                                          │
│ dump        Print a stored access or refresh token secret.                               │
│ refresh-to  Use the active users cached refresh token to log in as another FOCI client.  │
│ insert      Insert an externally sourced token into the cache.                           │
│ enum        Enumerate Entra directory objects.                                           │
│ config      View and edit non-secret settings (~/.config/gts/settings.json).             │
│ clients     Search and reference first-party / FOCI clients.                             │
╰──────────────────────────────────────────────────────────────────────────────────────────╯

$> gts login -c azpowershell
$> gts enum current-user

Storage backends

Tokens are stored through a pluggable StorageBackend, selected by the storage_backend setting (gts config set storage_backend …, or the GTS_STORAGE_BACKEND env var):

Value Backend
keyring (default) OS keyring — macOS Keychain / gnome-keyring, via the keyring library.
onepassword 1Password via the op CLI. Authorization is cached per terminal session, so you approve once per terminal, not per command.

LLM Disclosure

This repository was generated via Claude Code using Opus 4.8 with minimal human review. Initial plans are stored in the docs/plans folder (v1 drafted by me, v2 iterated upon via Claude Code). In it's current state, the code is mostly write-only (by agents)...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graph_token_store-0.1.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graph_token_store-0.1.0-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file graph_token_store-0.1.0.tar.gz.

File metadata

  • Download URL: graph_token_store-0.1.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for graph_token_store-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da63a752bb40c8fac39e12de594a58180201641921ba2f18c76da5ad86f54a25
MD5 f7ebb770fe018a58a4c15a48a10aed25
BLAKE2b-256 10350cdf0caca141d6dab09adf7becddc68ac992999704370cf5946bc6b9d76b

See more details on using hashes here.

File details

Details for the file graph_token_store-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: graph_token_store-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for graph_token_store-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 619f3cbca5c8095729fa0c1e0a186fb057e78200fcf03d4d92292cf6194da5ed
MD5 803a0f218af799ef5b6858e8005665df
BLAKE2b-256 db5df28cee49f2c66a66bdde3bc07695fa3dcc1503faf96e3d6b052423099b7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page