Skip to content

API create PAT for Service Accounts by group owners

What does this MR do and why?

Provides an API endpoint for creating token for service account user by group owner This is in continuation of !122758 (merged) and Solution for #406781 (closed)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a group and ensure your test user is an owner.
  2. Create a Personal Access Token with api scope.
  3. Use the token to perform following curl requests

Create a Personal Access Token for the user

curl -XPOST "https://gdk.test:3443/api/v4/groups/<group_id>/service_accounts/<user_id>/personal_access_tokens?access_token=<token_value>" --data "scopes[]=api" --data "name=service_accounts_token"

Revoke a Personal Access Token for the user

curl -XPOST "https://gdk.test:3443/api/v4/groups/<group_id>/service_accounts/<user_id>/personal_access_tokens/<token_id_to_rotate>/rotate?access_token=<token_value>"                                               

Screenshots showing the curl requests working

Screenshot_2023-06-13_at_1.26.46_PM

Edited by Smriti Garg

Merge request reports

Loading