fortniteruby 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/fortniteruby/client.rb +44 -0
- metadata +56 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e2f5dda31bae598894f37da9bdd75f8b030d386f31cd3b10b76af5cbf6259c37
|
|
4
|
+
data.tar.gz: ea88b4c6bc46a71316c8299b46b5b1417fbe37b98da8ce5a56cc7a9eaa684f79
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eefd1c1b911f2d66260aebd35203874cd2d2a6faa438df3624f04acee7123b7010b5e1965206dda5a8eca7f04d8a4e68befa874e0aa0b0c7b075689e03496fbc
|
|
7
|
+
data.tar.gz: 5f76caba6a129521e36d16070f4aa8ba50b7ba7f62cf67028de665a7d25f3f5c229e8d7a35993c2f4f9b7f71cc51d6a3499a37caaa9bdbf1def50d120b930f98
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
|
|
3
|
+
class FortniteClient
|
|
4
|
+
def initialize(email, password)
|
|
5
|
+
csrf = HTTParty.get('https://www.epicgames.com/id/api/csrf')
|
|
6
|
+
cookie = "EPIC_FUNNEL_ID=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[1]}; EPIC_DEVICE=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[24]}; EPIC_SESSION_ID=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[47]}; XSRF-TOKEN=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[54]}; EPIC_SSO_SESSION=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[59]}"
|
|
7
|
+
|
|
8
|
+
headers = {"x-xsrf-token" => csrf.headers['Set-Cookie'].split(/[\s=;]/)[54], "Cookie" => cookie}
|
|
9
|
+
body = {'email': email, 'password': password, 'rememberMe': false}
|
|
10
|
+
login = HTTParty.post("https://www.epicgames.com/id/api/login", :headers => headers, :body => body)
|
|
11
|
+
cookie = "EPIC_FUNNEL_ID=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[1]}; EPIC_DEVICE=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[24]}; EPIC_SESSION_ID=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[47]}; XSRF-TOKEN=#{csrf.headers['Set-Cookie'].split(/[\s=;]/)[54]}; EPIC_SSO_SESSION=#{login.headers['Set-Cookie'].split(/[\s=;]/)[1]}"
|
|
12
|
+
|
|
13
|
+
headers = {"x-xsrf-token" => csrf.headers['Set-Cookie'].split(/[\s=;]/)[54], "Cookie" => cookie}
|
|
14
|
+
exchange = HTTParty.get('https://www.epicgames.com/id/api/exchange', :headers => headers)
|
|
15
|
+
|
|
16
|
+
headers = {"Authorization" => 'basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE='}
|
|
17
|
+
body = {'grant_type': 'exchange_code', 'token_type': 'eg1', 'exchange_code': JSON.parse(exchange.body)['code']}
|
|
18
|
+
token = HTTParty.post("https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/token", :headers => headers, :body => body)
|
|
19
|
+
@launcherauth = JSON.parse(token.body)['access_token']
|
|
20
|
+
|
|
21
|
+
headers = {"Authorization" => "Bearer #{JSON.parse(token.body)['access_token']}"}
|
|
22
|
+
fortniteExchange = HTTParty.get("https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/exchange", :headers => headers)
|
|
23
|
+
|
|
24
|
+
headers = {"Authorization" => 'basic ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ='}
|
|
25
|
+
body = {'grant_type': 'exchange_code', 'token_type': 'eg1', 'exchange_code': JSON.parse(fortniteExchange.body)['code']}
|
|
26
|
+
fortniteToken = HTTParty.post("https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/token", :headers => headers, :body => body)
|
|
27
|
+
|
|
28
|
+
headers = {"Authorization" => "bearer #{JSON.parse(fortniteToken.body)['access_token']}"}
|
|
29
|
+
account = HTTParty.get("https://account-public-service-prod03.ol.epicgames.com/account/api/public/account/#{JSON.parse(fortniteToken.body)['account_id']}", :headers => headers)
|
|
30
|
+
@token = JSON.parse(fortniteToken.body)['access_token']
|
|
31
|
+
|
|
32
|
+
body = JSON.parse(account.body)
|
|
33
|
+
|
|
34
|
+
body.each do |name, value|
|
|
35
|
+
instance_variable_set("@#{name}", value)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
attr_reader :displayName
|
|
41
|
+
attr_reader :id
|
|
42
|
+
attr_reader :token
|
|
43
|
+
|
|
44
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fortniteruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.3
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- xMistt
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-11-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: httparty
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.17.1
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.17.1
|
|
27
|
+
description:
|
|
28
|
+
email:
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- lib/fortniteruby/client.rb
|
|
34
|
+
homepage: https://github.com/xMistt/FortniteRuby/
|
|
35
|
+
licenses: []
|
|
36
|
+
metadata: {}
|
|
37
|
+
post_install_message:
|
|
38
|
+
rdoc_options: []
|
|
39
|
+
require_paths:
|
|
40
|
+
- lib
|
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '0'
|
|
51
|
+
requirements: []
|
|
52
|
+
rubygems_version: 3.0.6
|
|
53
|
+
signing_key:
|
|
54
|
+
specification_version: 4
|
|
55
|
+
summary: Gem for interacting with Fortnite/Epic Games API.
|
|
56
|
+
test_files: []
|