module Bithavoc::Identity::Negotiate
Public Instance Methods
negotiate(auth_code)
click to toggle source
# File lib/bithavoc/identity/operations/negotiate.rb, line 4 def negotiate(auth_code) res = self.class.post("/apps/#{app_id}/tokens", body: {code: auth_code}) case res.code when 201 return res['token'], res['user'] when 422 raise Bithavoc::Identity::IdentityError.new, res['message'] else raise Bithavoc::Identity::IdentityError.new, "Something went wrong while validating your credentials" end end