Sha256: 61b924639c8c54baff963dcb149072e225ab26be82042c60bd426a1652d4642c
Contents?: true
Size: 989 Bytes
Versions: 5
Compression:
Stored size: 989 Bytes
Contents
# frozen_string_literal: true module Globus class Client # The namespace for the "login" command class Authenticator def self.token(client_id, client_secret, auth_url) new(client_id, client_secret, auth_url).token end def initialize(client_id, client_secret, auth_url) @client_id = client_id @client_secret = client_secret @auth_url = auth_url end # Request an access_token def token response = connection.post("/v2/oauth2/token", form_data) JSON.parse(response.body)["access_token"] end private attr_reader :client_id, :client_secret, :auth_url def connection Faraday.new(url: auth_url) end def form_data { client_id:, client_secret:, encoding: "form", grant_type: "client_credentials", scope: "urn:globus:auth:scope:transfer.api.globus.org:all" } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems