Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Get NiFi authentication token in a secured instance

Highlighted

Get NiFi authentication token in a secured instance

New Contributor

Hi,


I'd like to obtain a token that allow me to perform certain read operations over a secured NiFi instance. To achieve so, I'm executing:


curl 'http://<ip_nifi>:<port_nifi>/nifi-api/access/token' -H 'Accept-Encoding: gzip, deflate,br' -H 'Content-Type:application/x-www-form-urlencoded;charset=UTF-8' -H 'Accept: */*' --data 'username=<my_username>&password=<my_password>' --compressed

But I'm having no success. In fact, when I execute this command, the message returned is:

<!DOCTYPE html>

<html lang="es" >

<meta charset="UTF-8">

<head>

<title>NIFI</title>

<link rel="stylesheet" href="pcss/style.css">

</head>

<body>

<video autoplay muted loop id="video">

<source src="pvideo/background.webm" type="video/mp4">

Tu navegador no soporta video HTML5.

</video>

<div class="content">

<div class="login">

<div class="logo"></div>

<form method="post" action="/login">

<input type="text" placeholder="User" required="required" name="httpd_username" />

<input type="password" placeholder="Password" required="required" name="httpd_password" />

<input type="hidden" name="httpd_location" value="/nifi" />

<input class="submit" type="submit" class="btn btn-primary btn-block btn-large" value="Iniciar Sesión" />

</form>

</div>

</div>

</body>

</html>


Which is, in fact, the HTML code of the login screen. How could I obtain the token instead of this message?


Thanks for your help.



1 REPLY 1

Re: Get NiFi authentication token in a secured instance

@CarlosHS

Here is a command I used to get a token:

curl 'https://nifi-hostname:nifi-port/nifi-api/access/token' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'username=username&password=password' --compressed --insecure

Don't have an account?
Coming from Hortonworks? Activate your account here