OC Authentication Helper

Retrieve OAuth tokens and inject Authorization headers into curl requests for OpenShift clusters.

112|305|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/openshift-eng/ai-helpers --skill oc-authentication-helper
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: OC Authentication Helper
Source: https://github.com/openshift-eng/ai-helpers/tree/main/plugins/ci/skills/oc-auth
Command: npx skills add https://github.com/openshift-eng/ai-helpers --skill oc-authentication-helper

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Users often struggle with securely managing OAuth tokens for multiple OpenShift clusters, leading to token exposure, code duplication, and complex authentication logic. This skill centralizes token retrieval and injection, eliminating these issues and simplifying authenticated API requests.

Core Features & Use Cases

  • Automated Token Handling: Automatically retrieves and injects OAuth tokens into curl requests.
  • Multi-Cluster Support: Seamlessly works with multiple OpenShift cluster contexts configured in kubeconfig.
  • Enhanced Security: Prevents accidental token exposure in command history or logs.
  • Use Case: Instead of manually fetching tokens and adding Authorization headers, simply prefix your curl command with curl_with_token.sh <cluster_api_url> to make secure API calls to any OpenShift cluster.

Quick Start

Example: Authenticated API call to app.ci cluster

curl_with_token.sh https://api.ci.l2s4.p1.openshiftapps.com:6443 -X POST
-d '{"job_name": "my-job"}'
https://gangway-ci.apps.ci.l2s4.p1.openshiftapps.com/v1/executions

Frequently Asked Questions about OC Authentication Helper

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I securely authenticate curl requests to multiple OpenShift clusters?

Secure authentication to multiple OpenShift clusters using curl requires retrieving OAuth tokens from the correct cluster context and injecting them into request headers. This Skill automates token retrieval via oc whoami -t, selects the active cluster context, and injects the Authorization: Bearer header into curl commands while preventing token exposure in logs or command history.

Can I make authenticated API calls to OpenShift without manually managing OAuth tokens?

Yes. Instead of manually fetching tokens with oc whoami -t and building Authorization headers, prefix your curl command with this Skill to automatically retrieve the token for your current cluster context, inject it securely into the request, and execute the API call—eliminating manual token handling and exposure risk.

How do I avoid token exposure when calling OpenShift APIs from scripts?

Token exposure in scripts occurs when tokens are echoed, logged, or stored in plain text. This Skill prevents exposure by retrieving tokens internally, injecting them directly into curl headers, and ensuring tokens never appear in command output or shell history while maintaining full authentication.

What do I need before using authenticated curl requests to OpenShift?

You need the OpenShift CLI (oc) installed, configured kubeconfig with cluster contexts, and access to the target OpenShift cluster. This Skill uses oc to discover contexts and retrieve tokens, then passes them securely to curl for API authentication across any configured cluster.

Does this work with multiple kubeconfig contexts and different OpenShift clusters?

Yes. This Skill seamlessly handles multi-cluster environments by discovering available contexts in kubeconfig, selecting the correct cluster context, and retrieving that context's OAuth token to authenticate requests to any configured OpenShift cluster (such as app.ci or dpcr).

Why use an authentication helper instead of manual curl with bearer tokens?

Manual token injection is repetitive, error-prone, and creates security risks: tokens may leak into logs or history. An authentication helper centralizes token retrieval and injection, eliminates code duplication across commands, prevents token exposure, and simplifies authenticated API calls across multiple clusters.