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.1.tar.gz (34.8 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.1-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: graph_token_store-0.1.1.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for graph_token_store-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4e3942cab3981986bfd01d104b476f3c68fc016b39b4e72644ae990845f7dd8a
MD5 8467a293374c6906824d6ee2918575c2
BLAKE2b-256 4113870c832029154f9d502005c3c525d187479b80a513c785894bac6aa5c1f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: graph_token_store-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 41.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for graph_token_store-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f090fb284cb4b58cdd955821e8850adbbbe56915d98ec7a4409191eb33f5c766
MD5 8816f33d00954c7bab5625606b4a2f4a
BLAKE2b-256 04a6793b0619adf76ce680cf9b9514b0972dd29c2279a3f2b82cf2375bdbfe23

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