Hello Everyone,
I wanted to know, how we can delete personal access token of specific user either through groovy script,Rest API or DB Query .I found below document ,to fetch list of access token-
Working Query:-
SELECT DISTINCT u.lower_first_name || ' ' || u.lower_last_name AS full_name, pt."NAME" AS token_name, pt."LAST_ACCESSED_AT", pt."EXPIRING_AT",
bool_or(CASE
WHEN m.parent_name IN (SELECT group_id FROM globalpermissionentry WHERE permission IN ('ADMINISTER','SYSTEM_ADMIN')) THEN true
ELSE false
END) AS admin_rights
FROM "AO_81F455_PERSONAL_TOKEN" AS pt
INNER JOIN app_user AS k ON k.user_key = pt."USER_KEY"
INNER JOIN cwd_membership AS m ON m.lower_child_name = k.lower_user_name
INNER JOIN cwd_user AS u ON u.lower_user_name = k.lower_user_name
WHERE u.active = 1
AND ((pt."LAST_ACCESSED_AT" >= CURRENT_DATE) OR (pt."LAST_ACCESSED_AT" IS NULL))
GROUP BY u.lower_first_name, u.lower_last_name, pt."NAME", pt."LAST_ACCESSED_AT", pt."EXPIRING_AT";
Working REST API:-
{{baseUrlOfYourInstance}}/rest/pat/latest/tokens
Is there any REST API to fetch PAT of specific user
Thanks and Regards,
Jyoti
It seems there is no Rest API to get the token. The one you've shared is only for the current user.
On the DB you can query the AO_81F455_PERSONAL_TOKEN to get the token name and user that created it.
Here is a good query for that:
Sadly only from the DB can we get that information.
Regards
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.