Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Why can't I get token to use nifi api?

avatar
New Contributor

Hello! How's it going? I'm having trouble using the nifi API ....

Why can't I get token to use nifi api? , we use LDAP for authentication.

I am using the following (Python):

 

import requests

url = 'https://managmentsite.cloudera.site/apdazrusbicdpdfl/cdp-proxy-api/nifi-app/nifi-api/access/token'
headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
data = {
'username': 'user',
'password': 'pass'
}

response = requests.post(url, headers=headers, data=data, verify=False)
print(response.text)
print(response.status_code)
print(response.content)

 

BKZ_0-1692887206020.png

 



the api endpoint is correct (url),
the username and password are correct,
What is the error due to?

2 REPLIES 2

avatar
Super Mentor

@BKZ 

Can you share more about your environment setup. 
Are you using Knox (from URL it appears so)?  What topology is setup in knox for NiFI and NiFI-API?
What are all the methods of user authentication you have setup (nifi.properties file would help here)?
You are getting a 401 unauthorized response.  Are you seeing anything logged in the nifi-user.log when you execute your python code?

Have you tried going directly to the NiFi node's nifi-api endpoint instead of going through the cdp-proxy-api?

What version of CDP and CFM are you using?

The details may help get more responses from within the community.

Thank you,

Matt

avatar
Community Manager

@BKZ Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. If you are still experiencing the issue, can you provide the information @MattWho has requested? Thanks.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: