Created 03-19-2025 02:51 PM
We need help to get token to execute Apache NiFi API which is running on Linux and OAuth authentication.
The below two steps we have taken.
Example:
Step 1:
Token from Azure:
curl -X POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id={CliendID}" \
-d "client_secret={ClientSecret}" \
-d "scope={CliendID}/.default"
Result: Generated successful "{token}"
Step 2:
curl -X POST https://NIFIDnsName:9444/nifi-api/access/oidc/exchange \
-H "Authorization: Bearer {token}"
Error:
Unauthorized error="invalid_token", error_description="An error occurred while attempting to decode the Jwt: Signed JWT rejected: Another algorithm exp
nifi.properties file:
nifi.security.user.oidc.discovery.url=https://login.microsoftonline.com/{tanent}/v2.0/.well-known/openid-configuration
nifi.security.user.oidc.connect.timeout=5 secs
nifi.security.user.oidc.read.timeout=5 secs
nifi.security.user.oidc.client.id=*********************
nifi.security.user.oidc.client.secret=**********************
nifi.security.user.oidc.preferred.jwsalgorithm=RS256
nifi.security.user.oidc.additional.scopes=offline_access
nifi.security.user.oidc.claim.identifying.user=email
nifi.security.user.oidc.fallback.claims.identifying.user=
nifi.security.user.oidc.claim.groups=groups
nifi.security.user.oidc.truststore.strategy=JDK
nifi.security.user.oidc.token.refresh.window=60 secs
nifi.security.user.oidc.pkce.enabled=true
nifi.security.user.oidc.jwt.algorithm=RS256
Can you help us steps to execute simple NiFi API call which is running OAuth authentication.
Created 03-19-2025 04:38 PM
@RaoNEY Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @mburgess @MattWho @Shelton who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created on 03-20-2025 01:47 PM - edited 03-20-2025 01:48 PM
The error message suggests that there's a JWT token algorithm mismatch: "An error occurred while attempting to decode the Jwt: Signed JWT rejected: Another algorithm exp"
This typically happens when:
Verify token algorithm
First, check what algorithm your Azure token is using. You can decode your JWT token using tools like jwt.io to see the header which contains the algorithm (look for the "alg" field).
Modify your Azure token request
Azure AD OAuth tokens typically use RS256, but you may need to specify this explicitly in your Azure app registration settings.
Ensure correct token type
For NiFi OAuth/OIDC authentication, you need an ID token, not an access token. In your Step 1, you're requesting a client credentials grant which returns an access token. Instead, you need to:
Update NiFi properties: Ensure these settings match your Azure configuration:
Complete Authentication Flow
For NiFi OAuth with Azure AD, the proper flow should be:
1. Initiate login via NiFi UI or using
2. This redirects to Microsoft login page, where user authenticates
3. After successful authentication, Azure redirects back to NiFi with an authorization code
4. NiFi exchanges this code for tokens automatically
5. If you're doing this programmatically, use the authorization code flow, not client credentials
The direct token exchange you're attempting in Step 2 might not be supported or requires specific configuration. NiFi typically handles the OIDC token exchange internally after receiving the authorization code.
The direct token exchange you're attempting in Step 2 might not be supported or requires specific configuration. NiFi typically handles the OIDC token exchange internally after receiving the authorization code.
happy hadooping
Created 04-15-2025 02:59 PM
How do we get AuthorizationCode for step one. Can you please provide curl commands to get token to use Nifi api calls
Created 04-01-2025 08:47 AM
@RaoNEY 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. Thanks.
Regards,
Diana Torres,