agentsclimarketplace

Langgraph auth inject from runnable config

Skill kjuhwa/skills-hub/skills/agent-sdk/langgraph-auth-inject-from-runnable-config

Hydrate auth/user/org/thread/run identifiers into LangGraph state from the RunnableConfig at the very first node, so every downstream node sees a uniform identity payload regardless of caller.From its SKILL.md

Install
npx -y skills add kjuhwa/skills-hub --skill langgraph-auth-inject-from-runnable-config

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.4 KB, 419 tokens by cl100k_base, as published. Nobody here has run it

LangGraph Auth Inject Node

When to use

LangGraph servers expose authenticated user info in config["configurable"]["langgraph_auth_user"]. You want that info inside state (so every node can access it without re-parsing config), and you want graceful fallback when running without auth (CLI, tests).

How it works

A single LangGraph node is set as the entry point. It reads from config["configurable"]["langgraph_auth_user"] plus thread_id/run_id, falls back to existing state keys, and returns a partial-update dict that LangGraph merges into state.

Example

def _extract_auth(state, config) -> dict[str, str]:
    configurable = config.get("configurable", {})
    auth = configurable.get("langgraph_auth_user", {})
    thread_id = configurable.get("thread_id", "") or state.get("thread_id", "")
    run_id    = configurable.get("run_id", "")    or state.get("run_id", "")
    return {
        "org_id":        auth.get("org_id")           or state.get("org_id", ""),
        "user_id":       auth.get("identity")         or state.get("user_id", ""),
        "user_email":    auth.get("email", ""),
        "user_name":     auth.get("full_name", ""),
        "organization_slug": auth.get("organization_slug", ""),
        "thread_id":     thread_id,
        "run_id":        run_id,
    }

def inject_auth_node(state, config):
    return _extract_auth(state, config)

graph.add_node("inject_auth", inject_auth_node)
graph.set_entry_point("inject_auth")

Gotchas

  • The node receives config as a positional argument because it has two parameters; LangGraph binds it automatically.
  • Always fall back to state values so CLI/tests that pre-populate state still work.
  • Keep the partial dict flat — nesting auth in a sub-key would force every downstream node to re-flatten.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,871. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.