Project

General

Profile

Change all api tokens automatically

Added by Fabio Sousa almost 3 years ago

Hello,

Do you have any tips on how I can change automatically the api tokens for all my users ?

Thank you.


Replies (1)

RE: Change all api tokens automatically - Added by Lorenzo Meneghetti almost 3 years ago

Hi, seems quite simple.
From rails console run:

  User.all.each do |user|
    user.api_token.try(:destroy)
    user.reload
  end

Please try the code on your own risk (not tested and provided as example, try it in development environment first and see effects).

Thanks
Lorenzo

    (1-1/1)