Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Dropbox API 开发一个应用程序,我想让用户在线浏览我的文件。
现在,我需要保存我的访问令牌并重复使用以让用户在线浏览我的 Dropbox 文件。
你的问题有点模糊,我不太了解 Dropbox,但我想存储访问令牌的一种方法是创建一个config/initializers/dropbox.rb文件并将令牌存储为常量:
config/initializers/dropbox.rb
SomeCustomClass::ACCESS_TOKEN = 'kjhcsuhrovuhpvouhsojfklerkjnfolrivjspofivjsoih'.freeze
现在,您可以通过调用此常量在应用程序中的任何位置使用令牌。