def access_token(code)
      response = connection.post("/api/oauth/token",
        client_id:     client_id,
        client_secret: client_secret,
        code:          code,
        redirect_uri:  redirect_uri,
        grant_type:    "authorization_code"
      )

      if response.success?
        OpenStruct.new(response.body)
      else
        raise Error.new(response.body["error_description"])
      end
    end
def access_token(code)
      response = connection.post("/api/oauth/token",
        client_id:     client_id,
        client_secret: client_secret,
        code:          code,
        redirect_uri:  redirect_uri,
        grant_type:    "authorization_code"
      )

      if response.success?
        OpenStruct.new(response.body)
      else
        raise Error.new(response.body["error_description"])
      end
    end
Public: Obtain the access token in order to use the API

 code - the temporary code obtained from the authorization callback

 Examples

   token = app.access_token(params[:code])
   token.access_token  # the access token that authenticates each API request
   token.store_id      # the authenticated Ecwid store_id

 Returns an OpenStruct which responds with the information needed to
 access the API for a store.