I’m using this documentation as my reference for revoking a personal access token.
I can view the personal_access_tokens table, but using the token name does not find anything that I can revoke.
$ sudo gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
GitLab: 14.10.2 (07d12f3fd11) FOSS
GitLab Shell: 13.25.1
PostgreSQL: 13.7
------------------------------------------------------------[ booted in 30.79s ]
Loading production environment (Rails 6.1.4.7)
irb(main):001:0> token = PersonalAccessToken.find_by_token('jgines-macbook')
=> nil
irb(main):002:0> token
=> nil
irb(main):003:0> token.revoke
Traceback (most recent call last):
1: from (irb):3
NoMethodError (undefined method `revoke' for nil:NilClass)
$ sudo gitlab-rails runner "PersonalAccessToken.find_by_token('jgines-macbook').revoke!"
Please specify a valid ruby command or the path of a script to run.
Run 'rails runner -h' for help.
undefined method `revoke!' for nil:NilClass