Created
August 16, 2018 11:10
-
-
Save NaiyaShah-BTC/154dffcbd31b7f78a115f6012b6da865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save_tokens(access, refresh) | |
TokenCred.create!(access: access, refresh: refresh) | |
end | |
def client | |
token_refresh_callback = lambda { |access, refresh, identifier| save_tokens(access, refresh) } | |
Boxr::Client.new(TokenCred.last.access, | |
refresh_token: TokenCred.last.refresh, | |
client_id: ENV['CLIENT_ID'], | |
client_secret: ENV['CLIENT_SECRET'], | |
&token_refresh_callback) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment