Sha256: 67609a055b5ab86796d55ce61603d085f0e7263c4428950c0fb4b6680ea60f20
Contents?: true
Size: 464 Bytes
Versions: 1
Compression:
Stored size: 464 Bytes
Contents
require 'net/https' require 'cgi/cookie' require_relative '../Exceptions/InvalidCredentials' require_relative '../User' class OfficeProvider def self.login(code) uri = URI("https://intra.epitech.eu/auth/office365?code=#{code}&state=%2f") response = Net::HTTP.get_response(uri) raise InvalidCredentials unless response.code.to_i == 302 cookie = CGI::Cookie::parse(response['Set-Cookie']) token = cookie['user'] User.new token end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
epitech_api-0.1.0 | lib/epitech_api/Provider/OfficeProvider.rb |