I am trying to access the NIFI using Rest API. I am using python requests library. I am able to generate the token using username and password but when I am trying to use the token to get the expiration of the token or the list of counters processors that I have created I am getting it is unauthorized.
import requests
response = requests.post("https://127.0.0.1:8443/nifi-api/access/token?username=<username>&password=<password>",headers={"Content-Type":"application/x-www-form-urlencoded"},verify=False) # if verify is true it will throw verification failed
token = response.content.decode() # got the token
#checking the token expiration
response = requests.get("https://127.0.0.1:8443/nifi-api/access/token/expiration",headers={"Accept":"*/*","Authorization":"Bearer {}".format(token)}) # using the generated token
print(response)
"Unauthorized"
I am able to get the response json using the same token through postman. So, I am not able to understand it. Is it because I am not verifying and not using any certificates causing the issue. Please anyone help me out here. Thanks!
@stevenmatison can you please look into it.