login_radius 11.0.0 → 11.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +19 -0
- data/LICENSE.txt +21 -21
- data/README.md +58 -58
- data/lib/login_radius/api/account/account_api.rb +581 -581
- data/lib/login_radius/api/account/role_api.rb +330 -330
- data/lib/login_radius/api/account/sott_api.rb +47 -47
- data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
- data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
- data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
- data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
- data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
- data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
- data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
- data/lib/login_radius/api/authentication/authentication_api.rb +1036 -989
- data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
- data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
- data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
- data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
- data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
- data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
- data/lib/login_radius/api/social/native_social_api.rb +255 -255
- data/lib/login_radius/api/social/social_api.rb +784 -806
- data/lib/login_radius/error.rb +7 -7
- data/lib/login_radius/request_client.rb +356 -295
- data/lib/login_radius/response.rb +18 -12
- data/lib/login_radius/version.rb +2 -2
- data/lib/login_radius.rb +30 -30
- data/login_radius.gemspec +25 -28
- metadata +8 -7
@@ -1,255 +1,255 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created by LoginRadius Development Team
|
4
|
-
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
-
require_relative '../../request_client'
|
6
|
-
|
7
|
-
module LoginRadius
|
8
|
-
# NativeSocialApi module
|
9
|
-
class NativeSocialApi
|
10
|
-
include RequestClient
|
11
|
-
|
12
|
-
attr_accessor :site_name, :api_key, :api_secret
|
13
|
-
|
14
|
-
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
-
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
-
def initialize
|
17
|
-
@site_name = ENV['SITE_NAME']
|
18
|
-
@api_key = ENV['API_KEY']
|
19
|
-
@api_secret = ENV['API_SECRET']
|
20
|
-
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
-
unless @site_name != '' && @site_name != nil
|
22
|
-
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
-
unless @api_key != '' && @api_key != nil
|
24
|
-
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
-
unless @api_secret != '' && @api_secret != nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response.
|
29
|
-
#
|
30
|
-
# @param fb__access__token - Facebook Access Token
|
31
|
-
# @param social_app_name - Name of Social provider APP
|
32
|
-
#
|
33
|
-
# @return Response containing Definition of Complete Token data
|
34
|
-
# 20.3
|
35
|
-
def get_access_token_by_facebook_access_token(fb__access__token, social_app_name = '')
|
36
|
-
if isNullOrWhiteSpace(fb__access__token)
|
37
|
-
raise LoginRadius::Error.new, getValidationMessage('fb__access__token')
|
38
|
-
end
|
39
|
-
|
40
|
-
query_parameters = {}
|
41
|
-
query_parameters['fb_Access_Token'] = fb__access__token
|
42
|
-
query_parameters['key'] = @api_key
|
43
|
-
unless isNullOrWhiteSpace(social_app_name)
|
44
|
-
query_parameters['socialAppName'] = social_app_name
|
45
|
-
end
|
46
|
-
|
47
|
-
resource_path = 'api/v2/access_token/facebook'
|
48
|
-
get_request(resource_path, query_parameters,
|
49
|
-
end
|
50
|
-
|
51
|
-
# The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response.
|
52
|
-
#
|
53
|
-
# @param tw__access__token - Twitter Access Token
|
54
|
-
# @param tw__token__secret - Twitter Token Secret
|
55
|
-
# @param social_app_name - Name of Social provider APP
|
56
|
-
#
|
57
|
-
# @return Response containing Definition of Complete Token data
|
58
|
-
# 20.4
|
59
|
-
def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret, social_app_name = '')
|
60
|
-
if isNullOrWhiteSpace(tw__access__token)
|
61
|
-
raise LoginRadius::Error.new, getValidationMessage('tw__access__token')
|
62
|
-
end
|
63
|
-
if isNullOrWhiteSpace(tw__token__secret)
|
64
|
-
raise LoginRadius::Error.new, getValidationMessage('tw__token__secret')
|
65
|
-
end
|
66
|
-
|
67
|
-
query_parameters = {}
|
68
|
-
query_parameters['key'] = @api_key
|
69
|
-
query_parameters['tw_Access_Token'] = tw__access__token
|
70
|
-
query_parameters['tw_Token_Secret'] = tw__token__secret
|
71
|
-
unless isNullOrWhiteSpace(social_app_name)
|
72
|
-
query_parameters['socialAppName'] = social_app_name
|
73
|
-
end
|
74
|
-
|
75
|
-
resource_path = 'api/v2/access_token/twitter'
|
76
|
-
get_request(resource_path, query_parameters,
|
77
|
-
end
|
78
|
-
|
79
|
-
# The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response.
|
80
|
-
#
|
81
|
-
# @param google__access__token - Google Access Token
|
82
|
-
# @param client_id - Google Client ID
|
83
|
-
# @param refresh_token - LoginRadius refresh token
|
84
|
-
# @param social_app_name - Name of Social provider APP
|
85
|
-
#
|
86
|
-
# @return Response containing Definition of Complete Token data
|
87
|
-
# 20.5
|
88
|
-
def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '', social_app_name = '')
|
89
|
-
if isNullOrWhiteSpace(google__access__token)
|
90
|
-
raise LoginRadius::Error.new, getValidationMessage('google__access__token')
|
91
|
-
end
|
92
|
-
|
93
|
-
query_parameters = {}
|
94
|
-
query_parameters['google_Access_Token'] = google__access__token
|
95
|
-
query_parameters['key'] = @api_key
|
96
|
-
unless isNullOrWhiteSpace(client_id)
|
97
|
-
query_parameters['client_id'] = client_id
|
98
|
-
end
|
99
|
-
unless isNullOrWhiteSpace(refresh_token)
|
100
|
-
query_parameters['refresh_token'] = refresh_token
|
101
|
-
end
|
102
|
-
unless isNullOrWhiteSpace(social_app_name)
|
103
|
-
query_parameters['socialAppName'] = social_app_name
|
104
|
-
end
|
105
|
-
|
106
|
-
resource_path = 'api/v2/access_token/google'
|
107
|
-
get_request(resource_path, query_parameters,
|
108
|
-
end
|
109
|
-
|
110
|
-
# This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration.
|
111
|
-
#
|
112
|
-
# @param id__token - Google JWT id_token
|
113
|
-
#
|
114
|
-
# @return Response containing Definition of Complete Token data
|
115
|
-
# 20.6
|
116
|
-
def get_access_token_by_google_j_w_t_access_token(id__token)
|
117
|
-
if isNullOrWhiteSpace(id__token)
|
118
|
-
raise LoginRadius::Error.new, getValidationMessage('id__token')
|
119
|
-
end
|
120
|
-
|
121
|
-
query_parameters = {}
|
122
|
-
query_parameters['id_Token'] = id__token
|
123
|
-
query_parameters['key'] = @api_key
|
124
|
-
|
125
|
-
resource_path = 'api/v2/access_token/googlejwt'
|
126
|
-
get_request(resource_path, query_parameters,
|
127
|
-
end
|
128
|
-
|
129
|
-
# The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response.
|
130
|
-
#
|
131
|
-
# @param ln__access__token - Linkedin Access Token
|
132
|
-
# @param social_app_name - Name of Social provider APP
|
133
|
-
#
|
134
|
-
# @return Response containing Definition of Complete Token data
|
135
|
-
# 20.7
|
136
|
-
def get_access_token_by_linkedin_access_token(ln__access__token, social_app_name = '')
|
137
|
-
if isNullOrWhiteSpace(ln__access__token)
|
138
|
-
raise LoginRadius::Error.new, getValidationMessage('ln__access__token')
|
139
|
-
end
|
140
|
-
|
141
|
-
query_parameters = {}
|
142
|
-
query_parameters['key'] = @api_key
|
143
|
-
query_parameters['ln_Access_Token'] = ln__access__token
|
144
|
-
unless isNullOrWhiteSpace(social_app_name)
|
145
|
-
query_parameters['socialAppName'] = social_app_name
|
146
|
-
end
|
147
|
-
|
148
|
-
resource_path = 'api/v2/access_token/linkedin'
|
149
|
-
get_request(resource_path, query_parameters,
|
150
|
-
end
|
151
|
-
|
152
|
-
# The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response.
|
153
|
-
#
|
154
|
-
# @param fs__access__token - Foursquare Access Token
|
155
|
-
#
|
156
|
-
# @return Response containing Definition of Complete Token data
|
157
|
-
# 20.8
|
158
|
-
def get_access_token_by_foursquare_access_token(fs__access__token)
|
159
|
-
if isNullOrWhiteSpace(fs__access__token)
|
160
|
-
raise LoginRadius::Error.new, getValidationMessage('fs__access__token')
|
161
|
-
end
|
162
|
-
|
163
|
-
query_parameters = {}
|
164
|
-
query_parameters['fs_Access_Token'] = fs__access__token
|
165
|
-
query_parameters['key'] = @api_key
|
166
|
-
|
167
|
-
resource_path = 'api/v2/access_token/foursquare'
|
168
|
-
get_request(resource_path, query_parameters,
|
169
|
-
end
|
170
|
-
|
171
|
-
# The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response.
|
172
|
-
#
|
173
|
-
# @param code - Apple Code
|
174
|
-
# @param social_app_name - Name of Social provider APP
|
175
|
-
#
|
176
|
-
# @return Response containing Definition of Complete Token data
|
177
|
-
# 20.12
|
178
|
-
def get_access_token_by_apple_id_code(code, social_app_name = '')
|
179
|
-
if isNullOrWhiteSpace(code)
|
180
|
-
raise LoginRadius::Error.new, getValidationMessage('code')
|
181
|
-
end
|
182
|
-
|
183
|
-
query_parameters = {}
|
184
|
-
query_parameters['code'] = code
|
185
|
-
query_parameters['key'] = @api_key
|
186
|
-
unless isNullOrWhiteSpace(social_app_name)
|
187
|
-
query_parameters['socialAppName'] = social_app_name
|
188
|
-
end
|
189
|
-
|
190
|
-
resource_path = 'api/v2/access_token/apple'
|
191
|
-
get_request(resource_path, query_parameters,
|
192
|
-
end
|
193
|
-
|
194
|
-
# This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code.
|
195
|
-
#
|
196
|
-
# @param code - WeChat Code
|
197
|
-
#
|
198
|
-
# @return Response containing Definition of Complete Token data
|
199
|
-
# 20.13
|
200
|
-
def get_access_token_by_we_chat_code(code)
|
201
|
-
if isNullOrWhiteSpace(code)
|
202
|
-
raise LoginRadius::Error.new, getValidationMessage('code')
|
203
|
-
end
|
204
|
-
|
205
|
-
query_parameters = {}
|
206
|
-
query_parameters['code'] = code
|
207
|
-
query_parameters['key'] = @api_key
|
208
|
-
|
209
|
-
resource_path = 'api/v2/access_token/wechat'
|
210
|
-
get_request(resource_path, query_parameters,
|
211
|
-
end
|
212
|
-
|
213
|
-
# The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response.
|
214
|
-
#
|
215
|
-
# @param vk_access_token - Vkontakte Access Token
|
216
|
-
#
|
217
|
-
# @return Response containing Definition of Complete Token data
|
218
|
-
# 20.15
|
219
|
-
def get_access_token_by_vkontakte_access_token(vk_access_token)
|
220
|
-
if isNullOrWhiteSpace(vk_access_token)
|
221
|
-
raise LoginRadius::Error.new, getValidationMessage('vk_access_token')
|
222
|
-
end
|
223
|
-
|
224
|
-
query_parameters = {}
|
225
|
-
query_parameters['key'] = @api_key
|
226
|
-
query_parameters['vk_access_token'] = vk_access_token
|
227
|
-
|
228
|
-
resource_path = 'api/v2/access_token/vkontakte'
|
229
|
-
get_request(resource_path, query_parameters,
|
230
|
-
end
|
231
|
-
|
232
|
-
# The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response.
|
233
|
-
#
|
234
|
-
# @param google_authcode - Google AuthCode
|
235
|
-
# @param social_app_name - Name of Social provider APP
|
236
|
-
#
|
237
|
-
# @return Response containing Definition of Complete Token data
|
238
|
-
# 20.16
|
239
|
-
def get_access_token_by_google_auth_code(google_authcode, social_app_name = '')
|
240
|
-
if isNullOrWhiteSpace(google_authcode)
|
241
|
-
raise LoginRadius::Error.new, getValidationMessage('google_authcode')
|
242
|
-
end
|
243
|
-
|
244
|
-
query_parameters = {}
|
245
|
-
query_parameters['apiKey'] = @api_key
|
246
|
-
query_parameters['google_authcode'] = google_authcode
|
247
|
-
unless isNullOrWhiteSpace(social_app_name)
|
248
|
-
query_parameters['socialAppName'] = social_app_name
|
249
|
-
end
|
250
|
-
|
251
|
-
resource_path = 'api/v2/access_token/google'
|
252
|
-
get_request(resource_path, query_parameters,
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Created by LoginRadius Development Team
|
4
|
+
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
+
require_relative '../../request_client'
|
6
|
+
|
7
|
+
module LoginRadius
|
8
|
+
# NativeSocialApi module
|
9
|
+
class NativeSocialApi
|
10
|
+
include RequestClient
|
11
|
+
|
12
|
+
attr_accessor :site_name, :api_key, :api_secret
|
13
|
+
|
14
|
+
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
+
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
+
def initialize
|
17
|
+
@site_name = ENV['SITE_NAME']
|
18
|
+
@api_key = ENV['API_KEY']
|
19
|
+
@api_secret = ENV['API_SECRET']
|
20
|
+
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
+
unless @site_name != '' && @site_name != nil
|
22
|
+
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
+
unless @api_key != '' && @api_key != nil
|
24
|
+
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
+
unless @api_secret != '' && @api_secret != nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response.
|
29
|
+
#
|
30
|
+
# @param fb__access__token - Facebook Access Token
|
31
|
+
# @param social_app_name - Name of Social provider APP
|
32
|
+
#
|
33
|
+
# @return Response containing Definition of Complete Token data
|
34
|
+
# 20.3
|
35
|
+
def get_access_token_by_facebook_access_token(fb__access__token, social_app_name = '')
|
36
|
+
if isNullOrWhiteSpace(fb__access__token)
|
37
|
+
raise LoginRadius::Error.new, getValidationMessage('fb__access__token')
|
38
|
+
end
|
39
|
+
|
40
|
+
query_parameters = {}
|
41
|
+
query_parameters['fb_Access_Token'] = fb__access__token
|
42
|
+
query_parameters['key'] = @api_key
|
43
|
+
unless isNullOrWhiteSpace(social_app_name)
|
44
|
+
query_parameters['socialAppName'] = social_app_name
|
45
|
+
end
|
46
|
+
|
47
|
+
resource_path = 'api/v2/access_token/facebook'
|
48
|
+
get_request(resource_path, query_parameters, {})
|
49
|
+
end
|
50
|
+
|
51
|
+
# The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response.
|
52
|
+
#
|
53
|
+
# @param tw__access__token - Twitter Access Token
|
54
|
+
# @param tw__token__secret - Twitter Token Secret
|
55
|
+
# @param social_app_name - Name of Social provider APP
|
56
|
+
#
|
57
|
+
# @return Response containing Definition of Complete Token data
|
58
|
+
# 20.4
|
59
|
+
def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret, social_app_name = '')
|
60
|
+
if isNullOrWhiteSpace(tw__access__token)
|
61
|
+
raise LoginRadius::Error.new, getValidationMessage('tw__access__token')
|
62
|
+
end
|
63
|
+
if isNullOrWhiteSpace(tw__token__secret)
|
64
|
+
raise LoginRadius::Error.new, getValidationMessage('tw__token__secret')
|
65
|
+
end
|
66
|
+
|
67
|
+
query_parameters = {}
|
68
|
+
query_parameters['key'] = @api_key
|
69
|
+
query_parameters['tw_Access_Token'] = tw__access__token
|
70
|
+
query_parameters['tw_Token_Secret'] = tw__token__secret
|
71
|
+
unless isNullOrWhiteSpace(social_app_name)
|
72
|
+
query_parameters['socialAppName'] = social_app_name
|
73
|
+
end
|
74
|
+
|
75
|
+
resource_path = 'api/v2/access_token/twitter'
|
76
|
+
get_request(resource_path, query_parameters, {})
|
77
|
+
end
|
78
|
+
|
79
|
+
# The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response.
|
80
|
+
#
|
81
|
+
# @param google__access__token - Google Access Token
|
82
|
+
# @param client_id - Google Client ID
|
83
|
+
# @param refresh_token - LoginRadius refresh token
|
84
|
+
# @param social_app_name - Name of Social provider APP
|
85
|
+
#
|
86
|
+
# @return Response containing Definition of Complete Token data
|
87
|
+
# 20.5
|
88
|
+
def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '', social_app_name = '')
|
89
|
+
if isNullOrWhiteSpace(google__access__token)
|
90
|
+
raise LoginRadius::Error.new, getValidationMessage('google__access__token')
|
91
|
+
end
|
92
|
+
|
93
|
+
query_parameters = {}
|
94
|
+
query_parameters['google_Access_Token'] = google__access__token
|
95
|
+
query_parameters['key'] = @api_key
|
96
|
+
unless isNullOrWhiteSpace(client_id)
|
97
|
+
query_parameters['client_id'] = client_id
|
98
|
+
end
|
99
|
+
unless isNullOrWhiteSpace(refresh_token)
|
100
|
+
query_parameters['refresh_token'] = refresh_token
|
101
|
+
end
|
102
|
+
unless isNullOrWhiteSpace(social_app_name)
|
103
|
+
query_parameters['socialAppName'] = social_app_name
|
104
|
+
end
|
105
|
+
|
106
|
+
resource_path = 'api/v2/access_token/google'
|
107
|
+
get_request(resource_path, query_parameters, {})
|
108
|
+
end
|
109
|
+
|
110
|
+
# This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration.
|
111
|
+
#
|
112
|
+
# @param id__token - Google JWT id_token
|
113
|
+
#
|
114
|
+
# @return Response containing Definition of Complete Token data
|
115
|
+
# 20.6
|
116
|
+
def get_access_token_by_google_j_w_t_access_token(id__token)
|
117
|
+
if isNullOrWhiteSpace(id__token)
|
118
|
+
raise LoginRadius::Error.new, getValidationMessage('id__token')
|
119
|
+
end
|
120
|
+
|
121
|
+
query_parameters = {}
|
122
|
+
query_parameters['id_Token'] = id__token
|
123
|
+
query_parameters['key'] = @api_key
|
124
|
+
|
125
|
+
resource_path = 'api/v2/access_token/googlejwt'
|
126
|
+
get_request(resource_path, query_parameters, {})
|
127
|
+
end
|
128
|
+
|
129
|
+
# The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response.
|
130
|
+
#
|
131
|
+
# @param ln__access__token - Linkedin Access Token
|
132
|
+
# @param social_app_name - Name of Social provider APP
|
133
|
+
#
|
134
|
+
# @return Response containing Definition of Complete Token data
|
135
|
+
# 20.7
|
136
|
+
def get_access_token_by_linkedin_access_token(ln__access__token, social_app_name = '')
|
137
|
+
if isNullOrWhiteSpace(ln__access__token)
|
138
|
+
raise LoginRadius::Error.new, getValidationMessage('ln__access__token')
|
139
|
+
end
|
140
|
+
|
141
|
+
query_parameters = {}
|
142
|
+
query_parameters['key'] = @api_key
|
143
|
+
query_parameters['ln_Access_Token'] = ln__access__token
|
144
|
+
unless isNullOrWhiteSpace(social_app_name)
|
145
|
+
query_parameters['socialAppName'] = social_app_name
|
146
|
+
end
|
147
|
+
|
148
|
+
resource_path = 'api/v2/access_token/linkedin'
|
149
|
+
get_request(resource_path, query_parameters, {})
|
150
|
+
end
|
151
|
+
|
152
|
+
# The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response.
|
153
|
+
#
|
154
|
+
# @param fs__access__token - Foursquare Access Token
|
155
|
+
#
|
156
|
+
# @return Response containing Definition of Complete Token data
|
157
|
+
# 20.8
|
158
|
+
def get_access_token_by_foursquare_access_token(fs__access__token)
|
159
|
+
if isNullOrWhiteSpace(fs__access__token)
|
160
|
+
raise LoginRadius::Error.new, getValidationMessage('fs__access__token')
|
161
|
+
end
|
162
|
+
|
163
|
+
query_parameters = {}
|
164
|
+
query_parameters['fs_Access_Token'] = fs__access__token
|
165
|
+
query_parameters['key'] = @api_key
|
166
|
+
|
167
|
+
resource_path = 'api/v2/access_token/foursquare'
|
168
|
+
get_request(resource_path, query_parameters, {})
|
169
|
+
end
|
170
|
+
|
171
|
+
# The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response.
|
172
|
+
#
|
173
|
+
# @param code - Apple Code
|
174
|
+
# @param social_app_name - Name of Social provider APP
|
175
|
+
#
|
176
|
+
# @return Response containing Definition of Complete Token data
|
177
|
+
# 20.12
|
178
|
+
def get_access_token_by_apple_id_code(code, social_app_name = '')
|
179
|
+
if isNullOrWhiteSpace(code)
|
180
|
+
raise LoginRadius::Error.new, getValidationMessage('code')
|
181
|
+
end
|
182
|
+
|
183
|
+
query_parameters = {}
|
184
|
+
query_parameters['code'] = code
|
185
|
+
query_parameters['key'] = @api_key
|
186
|
+
unless isNullOrWhiteSpace(social_app_name)
|
187
|
+
query_parameters['socialAppName'] = social_app_name
|
188
|
+
end
|
189
|
+
|
190
|
+
resource_path = 'api/v2/access_token/apple'
|
191
|
+
get_request(resource_path, query_parameters, {})
|
192
|
+
end
|
193
|
+
|
194
|
+
# This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code.
|
195
|
+
#
|
196
|
+
# @param code - WeChat Code
|
197
|
+
#
|
198
|
+
# @return Response containing Definition of Complete Token data
|
199
|
+
# 20.13
|
200
|
+
def get_access_token_by_we_chat_code(code)
|
201
|
+
if isNullOrWhiteSpace(code)
|
202
|
+
raise LoginRadius::Error.new, getValidationMessage('code')
|
203
|
+
end
|
204
|
+
|
205
|
+
query_parameters = {}
|
206
|
+
query_parameters['code'] = code
|
207
|
+
query_parameters['key'] = @api_key
|
208
|
+
|
209
|
+
resource_path = 'api/v2/access_token/wechat'
|
210
|
+
get_request(resource_path, query_parameters, {})
|
211
|
+
end
|
212
|
+
|
213
|
+
# The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response.
|
214
|
+
#
|
215
|
+
# @param vk_access_token - Vkontakte Access Token
|
216
|
+
#
|
217
|
+
# @return Response containing Definition of Complete Token data
|
218
|
+
# 20.15
|
219
|
+
def get_access_token_by_vkontakte_access_token(vk_access_token)
|
220
|
+
if isNullOrWhiteSpace(vk_access_token)
|
221
|
+
raise LoginRadius::Error.new, getValidationMessage('vk_access_token')
|
222
|
+
end
|
223
|
+
|
224
|
+
query_parameters = {}
|
225
|
+
query_parameters['key'] = @api_key
|
226
|
+
query_parameters['vk_access_token'] = vk_access_token
|
227
|
+
|
228
|
+
resource_path = 'api/v2/access_token/vkontakte'
|
229
|
+
get_request(resource_path, query_parameters, {})
|
230
|
+
end
|
231
|
+
|
232
|
+
# The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response.
|
233
|
+
#
|
234
|
+
# @param google_authcode - Google AuthCode
|
235
|
+
# @param social_app_name - Name of Social provider APP
|
236
|
+
#
|
237
|
+
# @return Response containing Definition of Complete Token data
|
238
|
+
# 20.16
|
239
|
+
def get_access_token_by_google_auth_code(google_authcode, social_app_name = '')
|
240
|
+
if isNullOrWhiteSpace(google_authcode)
|
241
|
+
raise LoginRadius::Error.new, getValidationMessage('google_authcode')
|
242
|
+
end
|
243
|
+
|
244
|
+
query_parameters = {}
|
245
|
+
query_parameters['apiKey'] = @api_key
|
246
|
+
query_parameters['google_authcode'] = google_authcode
|
247
|
+
unless isNullOrWhiteSpace(social_app_name)
|
248
|
+
query_parameters['socialAppName'] = social_app_name
|
249
|
+
end
|
250
|
+
|
251
|
+
resource_path = 'api/v2/access_token/google'
|
252
|
+
get_request(resource_path, query_parameters, {})
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|