Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

fabric8-services/fabric8-auth-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fabric8-auth-cli

fabric8-auth-cli provides a tool to retrieve an access token and optionally a refresh token from the CLI, by performing authentication on the preview or production platform and using the user’s credentials which can be provided either from the terminal prompt, or using a keyring interface (using the go-keyring library).

How to install

git clone https://github.com/fabric8-services/fabric8-auth-cli.git
make install

How to use it

osio login --help

Keyring support

On Linux and macOS, you can register a password for a service/account pair which can be used with the osio command so you don’t need to input your OpenShift.io account’s password each time.

On Linux, you can follow the instructions on the go-keyring docs.

On macOS, you can use the security command as follows:

security add-generic-password -a <username> -s <service_name> -w <password>
TIP

if the security add-generic-password command is prefixed with a space, it won’t be recorded in the terminal session history.

Once done, you can use the account and service as arguments in the osio login command:

osio login -t preview --keyring-user <username> --keyring-service <service_name>

You can even directly export the access token to an environment variable for later re-use with a curl command, for example:

export PREVIEW_TOKEN=`osio login -t preview --keyring-user <username> --keyring-service <service_name>`
curl -H "Authorization: Bearer $PREVIEW_TOKEN" https://auth.prod-preview.openshift.io/api/user -s | jq

License

This library is available under the Apache License Version 2.0.