GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation allows creating impersonation tokens for a specific user in GitLab via the API endpoint POST /api/v4/users/{user_id}/impersonation_tokens. It is useful for administrators who need to generate tokens to act on behalf of users for automation or integration purposes.

Use Case Examples

  1. An admin wants to generate an impersonation token for a user to allow a CI/CD pipeline to perform actions as that user.
  2. Creating a token to automate user-specific tasks without requiring the user's password.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the request (usually false).
Authentication The authentication method used, typically a GitLab API key credential.
baseUrl The base URL of the GitLab instance to which the request is sent.
Method HTTP method to use for the request, default is GET but POST is used for this operation.
Path Parameters Parameters to be included in the request path, specifically the user_id of the user for whom the impersonation token is created.

Output

JSON

  • id - The ID of the created impersonation token.
  • name - The name of the impersonation token.
  • token - The actual impersonation token string used for authentication.
  • scopes - The scopes or permissions granted to the impersonation token.
  • expires_at - The expiration date of the impersonation token.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the user_id path parameter is correctly set and corresponds to an existing user in GitLab.
  • Verify that the API key used for authentication has sufficient permissions to create impersonation tokens.
  • Check the baseUrl to ensure it points to the correct GitLab instance.
  • Common errors include 401 Unauthorized if authentication fails, 404 Not Found if the user_id does not exist, and 403 Forbidden if the API key lacks necessary permissions.

Links

Discussion