oc client requests token while logging in to OpenShift cluster using CLI

Solution Verified - Updated -

Issue

  • Why is it required to provide --username with oc login command?
  • oc client requests token while logging in to OpenShift cluster using CLI.
  • Command oc login is failing with the error
You must obtain an API token by visiting https://oauth-openshift.apps.test.example.com/oauth/token/request

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.7+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content