Skip to content

Retrieve an OpenShift API access token using a simple Python script. Useful for automation, scripting, or CI/CD pipelines.

License

Notifications You must be signed in to change notification settings

bkumar28/ocp-auth-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

OpenShift API Access Token

Install dependencies

 $ pip3 install requests

Edit the openshift_auth.py file:

PROTOCOL = "https"                    # or "http"
DOMAINNAME = "openshift.example.com" # your OpenShift domain
PORT = 6443                          # default API port
ocp_username = "admin"
ocp_password = "admin@123"
verify_ssl = False                   # set True if SSL cert trusted

host = f"{PROTOCOL}://api.{DOMAINNAME}:{PORT}"

initial_kwargs = {
    "ocp_username": ocp_username,
    "ocp_password": ocp_password,
    "verify_ssl": verify_ssl,
    "host": host,
}

Usage

Run the script to get your API access token:

 $ python3 openshift_auth.py

Reference

About

Retrieve an OpenShift API access token using a simple Python script. Useful for automation, scripting, or CI/CD pipelines.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages