Rails has a built in mechanism for token authentication, and it’s documented in the Rails Guides.