Actions24
- Admin Actions
- Dashboard Actions
- Dataset Actions
- Group Actions
- Report Actions
- Token Actions
Overview
This node facilitates interaction with the Microsoft Power BI API using header-based authentication. Specifically, for the Token - Get Token operation, it exchanges an authorization code obtained from Microsoft Entra ID (formerly Azure AD) for an access token. This is a crucial step in OAuth2 flows where you need to authenticate and authorize your application to access Power BI resources on behalf of a user.
Common scenarios include:
- Automating Power BI data workflows by programmatically obtaining access tokens.
- Integrating Power BI with other systems where manual token retrieval is impractical.
- Refreshing or acquiring tokens during OAuth2 authorization code grant flow.
Practical example:
- After a user authorizes your app via Microsoft Entra ID, you use this node to exchange the received authorization code for an access token, which can then be used to call Power BI APIs securely.
Properties
| Name | Meaning |
|---|---|
| Authentication Token | Bearer token for authentication (without the "Bearer" prefix). Used as the Authorization header value. |
| Token URL | URL endpoint to request the token from Microsoft Entra ID. Default: https://login.microsoftonline.com/common/oauth2/v2.0/token |
| Client ID | Application client ID registered in Microsoft Entra ID. |
| Client Secret | Secret key of the registered application in Microsoft Entra ID. |
| Authorization Code | The authorization code received from the authorization endpoint after user consent. |
| Redirect URI | The redirect URI used in the initial authorization request; must match exactly. |
| Grant Type | OAuth2 grant type used in the token request. For this operation, typically "authorization_code". |
| Scope | Space-separated list of scopes requested for access. Default includes Power BI API scope and offline access. |
Output
The node outputs JSON data containing the response from the Microsoft Entra ID token endpoint. Typically, this includes:
access_token: The OAuth2 access token to be used in subsequent API calls.refresh_token: Token used to refresh the access token when it expires.expires_in: Lifetime of the access token in seconds.- Other OAuth2 standard fields such as
token_type,scope, etc.
If the token request fails, the output will contain error details describing the failure.
No binary data output is involved in this operation.
Dependencies
- Requires network access to Microsoft Entra ID OAuth2 endpoints.
- Needs valid Microsoft Entra ID application registration with appropriate permissions/scopes configured.
- Requires correct client credentials (Client ID and Client Secret).
- The node expects the authorization code to be obtained beforehand via the OAuth2 authorization endpoint.
- No additional external libraries beyond those bundled with n8n are required.
Troubleshooting
- Missing or invalid authorization code: Ensure the authorization code is correctly obtained and not expired.
- Mismatched redirect URI: The redirect URI used here must exactly match the one used during the authorization request.
- Invalid client credentials: Verify that the Client ID and Client Secret are correct and correspond to the registered application.
- Scope issues: Confirm that the scopes requested are valid and granted for the application.
- Network errors: Check connectivity to the Microsoft Entra ID token endpoint.
- Error messages from Microsoft Entra ID: These usually indicate issues with the OAuth2 parameters; review the error description returned in the node output.
To resolve errors, verify all input parameters carefully and ensure the OAuth2 flow steps are followed correctly.