Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to construct nozzle consumer: Failed To Fetch Token #26

Open
webbbret opened this issue Jan 3, 2019 · 3 comments
Open

Failed to construct nozzle consumer: Failed To Fetch Token #26

webbbret opened this issue Jan 3, 2019 · 3 comments

Comments

@webbbret
Copy link

webbbret commented Jan 3, 2019

Kafka Version: 2.1.0
CF Version: 6.41.0+dd4c76cdd.2018-11-28
Go Version: go1.10.3 linux/amd64
OS: RHEL 7

I have confirmed that the username and password in the toml file will authenticate against the UAA endpoint, however, I am getting the following errors

[ERROR] Failed to construct nozzle consumer: failed to fetch token: Received a status code 401 Unauthorized

Followed by:

2019-01-02T17:26:53.628-08:00 [APP/PROC/WEB/2] [OUT] Exit status 2 2019-01-02T17:26:53.631-08:00 [CELL/SSHD/2] [OUT] Exit status 0

Note that I have Username and Password in the .toml file and do not have UAA_PASSWORD in the manifest. I have tried adding to manifest, but got the same results. Is there something I am not configuring correctly? Many thanks in advance for your help.

@giner
Copy link
Contributor

giner commented Jan 3, 2019

nozzle client has to be given doppler.firehose authority, e.g.

uaa:
  clients:
...
    kafka-nozzle:
      authorities: oauth.login,doppler.firehose
      authorized-grant-types: client_credentials
      override: true
      secret: SUPERSECRET
...

@webbbret
Copy link
Author

webbbret commented Jan 4, 2019

After creating a new Admin User (kafka-nozzle) with uaac client, and assigning the oauth.login, uaa.admin and doppler.firehose roles, I was finally able to get a token using the following command:

uaac token owner get cf kafka-nozzle -s "" -p MyPasswordHere

If I paste the token into my .toml file, I can get the nozzle to work, however, when I put the user and password into the .toml file without the token, I am unable to get a token and get the following error:

[ERROR] Failed to construct nozzle consumer: failed to fetch token: Received a status code 401 Unauthorized

Obviously, pasting the token will not be a permanent solution, as it will expire. So finding out how to get the token using the supplied credentials is critical. If you can provide any insight, it would be greatly appreciated. Cheers!

@webbbret
Copy link
Author

webbbret commented Jan 4, 2019

Turns out that a user was not needed at all. Instead, a client is required. After reading the source, I determined that the code wants a client_id and secret, of which a user does not have... only a client. After I created a client using the following:

uaac client create kafka-nozzle --authorized_grant_types client_credentials --authorities oauth.login,doppler.firehose --secret SomeSecretPwd

and set the username and password accordingly in the .toml file, all was well with the world! Cheers...hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants