module Fullscriptapi::AuthenticationEndpoints::CreateAnOauthToken
Public Instance Methods
create_an_oauth_token(grant)
click to toggle source
# File lib/fullscriptapi/authentication_endpoints/create_an_oauth_token.rb, line 8 def create_an_oauth_token(grant) # you need to have an auth grant to use this method raise unless client_id && secret && redirect_uri response = Excon.post("#{get_server}/api/oauth/token", headers: { "Content-Type": "application/json" }, body: { grant_type: "authorization_code", client_id: client_id, client_secret: secret, code: grant, redirect_uri: redirect_uri }.to_json ) body = JSON.parse(response.body) use_token(body["oauth"]) body end