Skip to content

Instantly share code, notes, and snippets.

@NaiyaShah-BTC
Created August 16, 2018 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NaiyaShah-BTC/154dffcbd31b7f78a115f6012b6da865 to your computer and use it in GitHub Desktop.
Save NaiyaShah-BTC/154dffcbd31b7f78a115f6012b6da865 to your computer and use it in GitHub Desktop.
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