Manually enter authorization code when logging into Tanzu Hub from cf CLI
search cancel

Manually enter authorization code when logging into Tanzu Hub from cf CLI

book

Article ID: 439178

calendar_today

Updated On:

Products

VMware Tanzu Platform - Hub

Issue/Introduction

When logging into Tanzu Hub from cf CLI you might face a situation that a web browser could not be automatically opened for the host where "cf login" is run (e.g. a Jumpbox).

Since option '--sso' is not supported by Tanzu Hub at the moment, you might need to manually input the authorization code.

$ cf login -a hub.example.net  --skip-ssl-validation --sso
API endpoint: hub.example.net

Option '--sso' not supported by Tanzu Hub, use 'cf login' to connect to a foundation.
FAILED

$ cf login -a hub.example.net  --skip-ssl-validation
API endpoint: hub.example.net

Listening on 127.0.0.1:0
Opening the browser window to complete the login
Warning: failed to open the browser for login:exec: "xdg-open,x-www-browser,www-browser": executable file not found in $PATH
Log in by visiting this link:
......

Environment

Tanzu Hub

Resolution

Try to load the sample link below in a local web browser and input credentials on request.

With the following example, you try to access the following given link and enter credentials. 

https://hub.example.net/auth/oauth/authorize?client_id=tp_cli_app&code_challenge=m7adZlIRe6DF3E8fL3hTVNwJjoHpvzTPjaYNgZboDRg&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A35901%2Fcallback&response_type=code&state=4e151e8824dc4244e855ecad961539a7

Then an error page might appear as illustrated by the following image.

Copy the code part in address bar including the prefix "uaa:". The code part that needs to be copied is also underlined in purple on the image below.

Past the copied code in "cf login" terminal and the login should succeed. 

$ cf login -a hub.example.net  --skip-ssl-validation
API endpoint: hub.example.net

Listening on 127.0.0.1:0
Opening the browser window to complete the login
Warning: failed to open the browser for login:exec: "xdg-open,x-www-browser,www-browser": executable file not found in $PATH
Log in by visiting this link:

  https://hub.example.net/auth/oauth/authorize?client_id=tp_cli_app&code_challenge=m7adZlIRe6DF3E8fL3hTVNwJjoHpvzTPjaYNgZboDRg&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A35901%2Fcallback&response_type=code&state=4e151e8824dc4244e855ecad961539a7

    Optionally, paste your authorization code: uaa:sguSUDL-SXpdhKdK9QO-EGnS726Bbrab
OK

Select an org group:
1. test1-0595d22e