login_radius 3.0.0 → 10.0.0.pre.beta
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 +5 -5
- data/LICENSE.txt +21 -0
- data/README.md +58 -52
- data/lib/login_radius.rb +30 -15
- data/lib/login_radius/api/account/account_api.rb +581 -0
- data/lib/login_radius/api/account/role_api.rb +330 -0
- data/lib/login_radius/api/account/sott_api.rb +47 -0
- data/lib/login_radius/api/advanced/configuration_api.rb +57 -0
- data/lib/login_radius/api/advanced/consent_management_api.rb +161 -0
- data/lib/login_radius/api/advanced/custom_object_api.rb +316 -0
- data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -0
- data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +606 -0
- data/lib/login_radius/api/advanced/re_authentication_api.rb +243 -0
- data/lib/login_radius/api/advanced/web_hook_api.rb +101 -0
- data/lib/login_radius/api/authentication/authentication_api.rb +986 -0
- data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -0
- data/lib/login_radius/api/authentication/password_less_login_api.rb +158 -0
- data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -0
- data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -0
- data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -0
- data/lib/login_radius/api/authentication/smart_login_api.rb +146 -0
- data/lib/login_radius/api/social/native_social_api.rb +193 -0
- data/lib/login_radius/api/social/social_api.rb +802 -0
- data/lib/login_radius/error.rb +7 -0
- data/lib/login_radius/request_client.rb +295 -0
- data/lib/login_radius/response.rb +12 -0
- data/lib/login_radius/version.rb +3 -3
- data/login_radius.gemspec +36 -0
- metadata +61 -20
- data/LICENSE +0 -22
- data/lib/hash.rb +0 -12
- data/lib/login_radius/advanced_api.rb +0 -133
- data/lib/login_radius/authentication_api.rb +0 -597
- data/lib/login_radius/exception.rb +0 -4
- data/lib/login_radius/management_api.rb +0 -327
- data/lib/login_radius/rest_request.rb +0 -142
- data/lib/login_radius/social_api.rb +0 -402
- data/lib/login_radius/two_fa_api.rb +0 -191
- data/lib/string.rb +0 -8
@@ -0,0 +1,160 @@
|
|
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
|
+
# OneTouchLoginApi module
|
9
|
+
class OneTouchLoginApi
|
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
|
+
# This API is used to send a link to a specified email for a frictionless login/registration
|
29
|
+
#
|
30
|
+
# @param one_touch_login_by_email_model - Model Class containing Definition of payload for OneTouchLogin By EmailModel API
|
31
|
+
# @param one_touch_login_email_template - Name of the One Touch Login Email Template
|
32
|
+
# @param redirecturl - Url where the user will redirect after success authentication
|
33
|
+
# @param welcomeemailtemplate - Name of the welcome email template
|
34
|
+
#
|
35
|
+
# @return Response containing Definition of Complete Validation data
|
36
|
+
# 1.2
|
37
|
+
def one_touch_login_by_email(one_touch_login_by_email_model, one_touch_login_email_template = '', redirecturl = '', welcomeemailtemplate = '')
|
38
|
+
if one_touch_login_by_email_model.blank?
|
39
|
+
raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_email_model')
|
40
|
+
end
|
41
|
+
|
42
|
+
query_parameters = {}
|
43
|
+
query_parameters['apiKey'] = @api_key
|
44
|
+
unless isNullOrWhiteSpace(one_touch_login_email_template)
|
45
|
+
query_parameters['oneTouchLoginEmailTemplate'] = one_touch_login_email_template
|
46
|
+
end
|
47
|
+
unless isNullOrWhiteSpace(redirecturl)
|
48
|
+
query_parameters['redirecturl'] = redirecturl
|
49
|
+
end
|
50
|
+
unless isNullOrWhiteSpace(welcomeemailtemplate)
|
51
|
+
query_parameters['welcomeemailtemplate'] = welcomeemailtemplate
|
52
|
+
end
|
53
|
+
|
54
|
+
resource_path = 'identity/v2/auth/onetouchlogin/email'
|
55
|
+
post_request(resource_path, query_parameters, one_touch_login_by_email_model)
|
56
|
+
end
|
57
|
+
|
58
|
+
# This API is used to send one time password to a given phone number for a frictionless login/registration.
|
59
|
+
#
|
60
|
+
# @param one_touch_login_by_phone_model - Model Class containing Definition of payload for OneTouchLogin By PhoneModel API
|
61
|
+
# @param sms_template - SMS Template name
|
62
|
+
#
|
63
|
+
# @return Response containing Definition of Complete Validation data
|
64
|
+
# 1.4
|
65
|
+
def one_touch_login_by_phone(one_touch_login_by_phone_model, sms_template = '')
|
66
|
+
if one_touch_login_by_phone_model.blank?
|
67
|
+
raise LoginRadius::Error.new, getValidationMessage('one_touch_login_by_phone_model')
|
68
|
+
end
|
69
|
+
|
70
|
+
query_parameters = {}
|
71
|
+
query_parameters['apiKey'] = @api_key
|
72
|
+
unless isNullOrWhiteSpace(sms_template)
|
73
|
+
query_parameters['smsTemplate'] = sms_template
|
74
|
+
end
|
75
|
+
|
76
|
+
resource_path = 'identity/v2/auth/onetouchlogin/phone'
|
77
|
+
post_request(resource_path, query_parameters, one_touch_login_by_phone_model)
|
78
|
+
end
|
79
|
+
|
80
|
+
# This API is used to verify the otp for One Touch Login.
|
81
|
+
#
|
82
|
+
# @param otp - The Verification Code
|
83
|
+
# @param phone - New Phone Number
|
84
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
85
|
+
# @param sms_template - SMS Template name
|
86
|
+
#
|
87
|
+
# @return Response Containing Access Token and Complete Profile Data
|
88
|
+
# 1.5
|
89
|
+
def one_touch_login_otp_verification(otp, phone, fields = '', sms_template = '')
|
90
|
+
if isNullOrWhiteSpace(otp)
|
91
|
+
raise LoginRadius::Error.new, getValidationMessage('otp')
|
92
|
+
end
|
93
|
+
if isNullOrWhiteSpace(phone)
|
94
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
95
|
+
end
|
96
|
+
|
97
|
+
query_parameters = {}
|
98
|
+
query_parameters['apiKey'] = @api_key
|
99
|
+
query_parameters['otp'] = otp
|
100
|
+
unless isNullOrWhiteSpace(fields)
|
101
|
+
query_parameters['fields'] = fields
|
102
|
+
end
|
103
|
+
unless isNullOrWhiteSpace(sms_template)
|
104
|
+
query_parameters['smsTemplate'] = sms_template
|
105
|
+
end
|
106
|
+
|
107
|
+
body_parameters = {}
|
108
|
+
body_parameters['phone'] = phone
|
109
|
+
|
110
|
+
resource_path = 'identity/v2/auth/onetouchlogin/phone/verify'
|
111
|
+
put_request(resource_path, query_parameters, body_parameters)
|
112
|
+
end
|
113
|
+
|
114
|
+
# This API verifies the provided token for One Touch Login
|
115
|
+
#
|
116
|
+
# @param verification_token - Verification token received in the email
|
117
|
+
# @param welcome_email_template - Name of the welcome email template
|
118
|
+
#
|
119
|
+
# @return Complete verified response data
|
120
|
+
# 8.4.2
|
121
|
+
def one_touch_email_verification(verification_token, welcome_email_template = '')
|
122
|
+
if isNullOrWhiteSpace(verification_token)
|
123
|
+
raise LoginRadius::Error.new, getValidationMessage('verification_token')
|
124
|
+
end
|
125
|
+
|
126
|
+
query_parameters = {}
|
127
|
+
query_parameters['apiKey'] = @api_key
|
128
|
+
query_parameters['verificationToken'] = verification_token
|
129
|
+
unless isNullOrWhiteSpace(welcome_email_template)
|
130
|
+
query_parameters['welcomeEmailTemplate'] = welcome_email_template
|
131
|
+
end
|
132
|
+
|
133
|
+
resource_path = 'identity/v2/auth/email/onetouchlogin'
|
134
|
+
get_request(resource_path, query_parameters, nil)
|
135
|
+
end
|
136
|
+
|
137
|
+
# This API is used to check if the One Touch Login link has been clicked or not.
|
138
|
+
#
|
139
|
+
# @param client_guid - Unique string used in the Smart Login request
|
140
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
141
|
+
#
|
142
|
+
# @return Response containing User Profile Data and access token
|
143
|
+
# 9.21.2
|
144
|
+
def one_touch_login_ping(client_guid, fields = '')
|
145
|
+
if isNullOrWhiteSpace(client_guid)
|
146
|
+
raise LoginRadius::Error.new, getValidationMessage('client_guid')
|
147
|
+
end
|
148
|
+
|
149
|
+
query_parameters = {}
|
150
|
+
query_parameters['apiKey'] = @api_key
|
151
|
+
query_parameters['clientGuid'] = client_guid
|
152
|
+
unless isNullOrWhiteSpace(fields)
|
153
|
+
query_parameters['fields'] = fields
|
154
|
+
end
|
155
|
+
|
156
|
+
resource_path = 'identity/v2/auth/login/smartlogin/ping'
|
157
|
+
get_request(resource_path, query_parameters, nil)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,158 @@
|
|
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
|
+
# PasswordLessLoginApi module
|
9
|
+
class PasswordLessLoginApi
|
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
|
+
# This API verifies an account by OTP and allows the customer to login.
|
29
|
+
#
|
30
|
+
# @param password_less_login_otp_model - Model Class containing Definition of payload for PasswordLessLoginOtpModel API
|
31
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
32
|
+
# @param sms_template - SMS Template name
|
33
|
+
#
|
34
|
+
# @return Response containing User Profile Data and access token
|
35
|
+
# 9.6
|
36
|
+
def passwordless_login_phone_verification(password_less_login_otp_model, fields = '', sms_template = '')
|
37
|
+
if password_less_login_otp_model.blank?
|
38
|
+
raise LoginRadius::Error.new, getValidationMessage('password_less_login_otp_model')
|
39
|
+
end
|
40
|
+
|
41
|
+
query_parameters = {}
|
42
|
+
query_parameters['apiKey'] = @api_key
|
43
|
+
unless isNullOrWhiteSpace(fields)
|
44
|
+
query_parameters['fields'] = fields
|
45
|
+
end
|
46
|
+
unless isNullOrWhiteSpace(sms_template)
|
47
|
+
query_parameters['smsTemplate'] = sms_template
|
48
|
+
end
|
49
|
+
|
50
|
+
resource_path = 'identity/v2/auth/login/passwordlesslogin/otp/verify'
|
51
|
+
put_request(resource_path, query_parameters, password_less_login_otp_model)
|
52
|
+
end
|
53
|
+
|
54
|
+
# API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID
|
55
|
+
#
|
56
|
+
# @param phone - The Registered Phone Number
|
57
|
+
# @param sms_template - SMS Template name
|
58
|
+
#
|
59
|
+
# @return Response Containing Definition of SMS Data
|
60
|
+
# 9.15
|
61
|
+
def passwordless_login_by_phone(phone, sms_template = '')
|
62
|
+
if isNullOrWhiteSpace(phone)
|
63
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
64
|
+
end
|
65
|
+
|
66
|
+
query_parameters = {}
|
67
|
+
query_parameters['apiKey'] = @api_key
|
68
|
+
query_parameters['phone'] = phone
|
69
|
+
unless isNullOrWhiteSpace(sms_template)
|
70
|
+
query_parameters['smsTemplate'] = sms_template
|
71
|
+
end
|
72
|
+
|
73
|
+
resource_path = 'identity/v2/auth/login/passwordlesslogin/otp'
|
74
|
+
get_request(resource_path, query_parameters, nil)
|
75
|
+
end
|
76
|
+
|
77
|
+
# This API is used to send a Passwordless Login verification link to the provided Email ID
|
78
|
+
#
|
79
|
+
# @param email - Email of the user
|
80
|
+
# @param password_less_login_template - Passwordless Login Template Name
|
81
|
+
# @param verification_url - Email verification url
|
82
|
+
#
|
83
|
+
# @return Response containing Definition of Complete Validation data
|
84
|
+
# 9.18.1
|
85
|
+
def passwordless_login_by_email(email, password_less_login_template = '', verification_url = '')
|
86
|
+
if isNullOrWhiteSpace(email)
|
87
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
88
|
+
end
|
89
|
+
|
90
|
+
query_parameters = {}
|
91
|
+
query_parameters['apiKey'] = @api_key
|
92
|
+
query_parameters['email'] = email
|
93
|
+
unless isNullOrWhiteSpace(password_less_login_template)
|
94
|
+
query_parameters['passwordLessLoginTemplate'] = password_less_login_template
|
95
|
+
end
|
96
|
+
unless isNullOrWhiteSpace(verification_url)
|
97
|
+
query_parameters['verificationUrl'] = verification_url
|
98
|
+
end
|
99
|
+
|
100
|
+
resource_path = 'identity/v2/auth/login/passwordlesslogin/email'
|
101
|
+
get_request(resource_path, query_parameters, nil)
|
102
|
+
end
|
103
|
+
|
104
|
+
# This API is used to send a Passwordless Login Verification Link to a customer by providing their UserName
|
105
|
+
#
|
106
|
+
# @param username - UserName of the user
|
107
|
+
# @param password_less_login_template - Passwordless Login Template Name
|
108
|
+
# @param verification_url - Email verification url
|
109
|
+
#
|
110
|
+
# @return Response containing Definition of Complete Validation data
|
111
|
+
# 9.18.2
|
112
|
+
def passwordless_login_by_user_name(username, password_less_login_template = '', verification_url = '')
|
113
|
+
if isNullOrWhiteSpace(username)
|
114
|
+
raise LoginRadius::Error.new, getValidationMessage('username')
|
115
|
+
end
|
116
|
+
|
117
|
+
query_parameters = {}
|
118
|
+
query_parameters['apiKey'] = @api_key
|
119
|
+
query_parameters['username'] = username
|
120
|
+
unless isNullOrWhiteSpace(password_less_login_template)
|
121
|
+
query_parameters['passwordLessLoginTemplate'] = password_less_login_template
|
122
|
+
end
|
123
|
+
unless isNullOrWhiteSpace(verification_url)
|
124
|
+
query_parameters['verificationUrl'] = verification_url
|
125
|
+
end
|
126
|
+
|
127
|
+
resource_path = 'identity/v2/auth/login/passwordlesslogin/email'
|
128
|
+
get_request(resource_path, query_parameters, nil)
|
129
|
+
end
|
130
|
+
|
131
|
+
# This API is used to verify the Passwordless Login verification link. Note: If you are using Passwordless Login by Phone you will need to use the Passwordless Login Phone Verification API
|
132
|
+
#
|
133
|
+
# @param verification_token - Verification token received in the email
|
134
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
135
|
+
# @param welcome_email_template - Name of the welcome email template
|
136
|
+
#
|
137
|
+
# @return Response containing User Profile Data and access token
|
138
|
+
# 9.19
|
139
|
+
def passwordless_login_verification(verification_token, fields = '', welcome_email_template = '')
|
140
|
+
if isNullOrWhiteSpace(verification_token)
|
141
|
+
raise LoginRadius::Error.new, getValidationMessage('verification_token')
|
142
|
+
end
|
143
|
+
|
144
|
+
query_parameters = {}
|
145
|
+
query_parameters['apikey'] = @api_key
|
146
|
+
query_parameters['verificationToken'] = verification_token
|
147
|
+
unless isNullOrWhiteSpace(fields)
|
148
|
+
query_parameters['fields'] = fields
|
149
|
+
end
|
150
|
+
unless isNullOrWhiteSpace(welcome_email_template)
|
151
|
+
query_parameters['welcomeEmailTemplate'] = welcome_email_template
|
152
|
+
end
|
153
|
+
|
154
|
+
resource_path = 'identity/v2/auth/login/passwordlesslogin/email/verify'
|
155
|
+
get_request(resource_path, query_parameters, nil)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,329 @@
|
|
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
|
+
# PhoneAuthenticationApi module
|
9
|
+
class PhoneAuthenticationApi
|
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
|
+
# This API retrieves a copy of the user data based on the Phone
|
29
|
+
#
|
30
|
+
# @param phone_authentication_model - Model Class containing Definition of payload for PhoneAuthenticationModel API
|
31
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
32
|
+
# @param login_url - Url where the user is logging from
|
33
|
+
# @param sms_template - SMS Template name
|
34
|
+
#
|
35
|
+
# @return Response containing User Profile Data and access token
|
36
|
+
# 9.2.3
|
37
|
+
def login_by_phone(phone_authentication_model, fields = '', login_url = '', sms_template = '')
|
38
|
+
if phone_authentication_model.blank?
|
39
|
+
raise LoginRadius::Error.new, getValidationMessage('phone_authentication_model')
|
40
|
+
end
|
41
|
+
|
42
|
+
query_parameters = {}
|
43
|
+
query_parameters['apiKey'] = @api_key
|
44
|
+
unless isNullOrWhiteSpace(fields)
|
45
|
+
query_parameters['fields'] = fields
|
46
|
+
end
|
47
|
+
unless isNullOrWhiteSpace(login_url)
|
48
|
+
query_parameters['loginUrl'] = login_url
|
49
|
+
end
|
50
|
+
unless isNullOrWhiteSpace(sms_template)
|
51
|
+
query_parameters['smsTemplate'] = sms_template
|
52
|
+
end
|
53
|
+
|
54
|
+
resource_path = 'identity/v2/auth/login'
|
55
|
+
post_request(resource_path, query_parameters, phone_authentication_model)
|
56
|
+
end
|
57
|
+
|
58
|
+
# This API is used to send the OTP to reset the account password.
|
59
|
+
#
|
60
|
+
# @param phone - New Phone Number
|
61
|
+
# @param sms_template - SMS Template name
|
62
|
+
#
|
63
|
+
# @return Response Containing Validation Data and SMS Data
|
64
|
+
# 10.4
|
65
|
+
def forgot_password_by_phone_otp(phone, sms_template = '')
|
66
|
+
if isNullOrWhiteSpace(phone)
|
67
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
68
|
+
end
|
69
|
+
|
70
|
+
query_parameters = {}
|
71
|
+
query_parameters['apiKey'] = @api_key
|
72
|
+
unless isNullOrWhiteSpace(sms_template)
|
73
|
+
query_parameters['smsTemplate'] = sms_template
|
74
|
+
end
|
75
|
+
|
76
|
+
body_parameters = {}
|
77
|
+
body_parameters['phone'] = phone
|
78
|
+
|
79
|
+
resource_path = 'identity/v2/auth/password/otp'
|
80
|
+
post_request(resource_path, query_parameters, body_parameters)
|
81
|
+
end
|
82
|
+
|
83
|
+
# This API is used to reset the password
|
84
|
+
#
|
85
|
+
# @param reset_password_by_otp_model - Model Class containing Definition of payload for ResetPasswordByOTP API
|
86
|
+
#
|
87
|
+
# @return Response containing Definition of Complete Validation data
|
88
|
+
# 10.5
|
89
|
+
def reset_password_by_phone_otp(reset_password_by_otp_model)
|
90
|
+
if reset_password_by_otp_model.blank?
|
91
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_password_by_otp_model')
|
92
|
+
end
|
93
|
+
|
94
|
+
query_parameters = {}
|
95
|
+
query_parameters['apiKey'] = @api_key
|
96
|
+
|
97
|
+
resource_path = 'identity/v2/auth/password/otp'
|
98
|
+
put_request(resource_path, query_parameters, reset_password_by_otp_model)
|
99
|
+
end
|
100
|
+
|
101
|
+
# This API is used to validate the verification code sent to verify a user's phone number
|
102
|
+
#
|
103
|
+
# @param otp - The Verification Code
|
104
|
+
# @param phone - New Phone Number
|
105
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
106
|
+
# @param sms_template - SMS Template name
|
107
|
+
#
|
108
|
+
# @return Response containing User Profile Data and access token
|
109
|
+
# 11.1.1
|
110
|
+
def phone_verification_by_otp(otp, phone, fields = '', sms_template = '')
|
111
|
+
if isNullOrWhiteSpace(otp)
|
112
|
+
raise LoginRadius::Error.new, getValidationMessage('otp')
|
113
|
+
end
|
114
|
+
if isNullOrWhiteSpace(phone)
|
115
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
116
|
+
end
|
117
|
+
|
118
|
+
query_parameters = {}
|
119
|
+
query_parameters['apiKey'] = @api_key
|
120
|
+
query_parameters['otp'] = otp
|
121
|
+
unless isNullOrWhiteSpace(fields)
|
122
|
+
query_parameters['fields'] = fields
|
123
|
+
end
|
124
|
+
unless isNullOrWhiteSpace(sms_template)
|
125
|
+
query_parameters['smsTemplate'] = sms_template
|
126
|
+
end
|
127
|
+
|
128
|
+
body_parameters = {}
|
129
|
+
body_parameters['phone'] = phone
|
130
|
+
|
131
|
+
resource_path = 'identity/v2/auth/phone/otp'
|
132
|
+
put_request(resource_path, query_parameters, body_parameters)
|
133
|
+
end
|
134
|
+
|
135
|
+
# This API is used to consume the verification code sent to verify a user's phone number. Use this call for front-end purposes in cases where the user is already logged in by passing the user's access token.
|
136
|
+
#
|
137
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
138
|
+
# @param otp - The Verification Code
|
139
|
+
# @param sms_template - SMS Template name
|
140
|
+
#
|
141
|
+
# @return Response containing Definition of Complete Validation data
|
142
|
+
# 11.1.2
|
143
|
+
def phone_verification_otp_by_access_token(access_token, otp, sms_template = '')
|
144
|
+
if isNullOrWhiteSpace(access_token)
|
145
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
146
|
+
end
|
147
|
+
if isNullOrWhiteSpace(otp)
|
148
|
+
raise LoginRadius::Error.new, getValidationMessage('otp')
|
149
|
+
end
|
150
|
+
|
151
|
+
query_parameters = {}
|
152
|
+
query_parameters['access_token'] = access_token
|
153
|
+
query_parameters['apiKey'] = @api_key
|
154
|
+
query_parameters['otp'] = otp
|
155
|
+
unless isNullOrWhiteSpace(sms_template)
|
156
|
+
query_parameters['smsTemplate'] = sms_template
|
157
|
+
end
|
158
|
+
|
159
|
+
resource_path = 'identity/v2/auth/phone/otp'
|
160
|
+
put_request(resource_path, query_parameters, nil)
|
161
|
+
end
|
162
|
+
|
163
|
+
# This API is used to resend a verification OTP to verify a user's Phone Number. The user will receive a verification code that they will need to input
|
164
|
+
#
|
165
|
+
# @param phone - New Phone Number
|
166
|
+
# @param sms_template - SMS Template name
|
167
|
+
#
|
168
|
+
# @return Response Containing Validation Data and SMS Data
|
169
|
+
# 11.2.1
|
170
|
+
def phone_resend_verification_otp(phone, sms_template = '')
|
171
|
+
if isNullOrWhiteSpace(phone)
|
172
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
173
|
+
end
|
174
|
+
|
175
|
+
query_parameters = {}
|
176
|
+
query_parameters['apiKey'] = @api_key
|
177
|
+
unless isNullOrWhiteSpace(sms_template)
|
178
|
+
query_parameters['smsTemplate'] = sms_template
|
179
|
+
end
|
180
|
+
|
181
|
+
body_parameters = {}
|
182
|
+
body_parameters['phone'] = phone
|
183
|
+
|
184
|
+
resource_path = 'identity/v2/auth/phone/otp'
|
185
|
+
post_request(resource_path, query_parameters, body_parameters)
|
186
|
+
end
|
187
|
+
|
188
|
+
# This API is used to resend a verification OTP to verify a user's Phone Number in cases in which an active token already exists
|
189
|
+
#
|
190
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
191
|
+
# @param phone - New Phone Number
|
192
|
+
# @param sms_template - SMS Template name
|
193
|
+
#
|
194
|
+
# @return Response Containing Validation Data and SMS Data
|
195
|
+
# 11.2.2
|
196
|
+
def phone_resend_verification_otp_by_token(access_token, phone, sms_template = '')
|
197
|
+
if isNullOrWhiteSpace(access_token)
|
198
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
199
|
+
end
|
200
|
+
if isNullOrWhiteSpace(phone)
|
201
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
202
|
+
end
|
203
|
+
|
204
|
+
query_parameters = {}
|
205
|
+
query_parameters['access_token'] = access_token
|
206
|
+
query_parameters['apiKey'] = @api_key
|
207
|
+
unless isNullOrWhiteSpace(sms_template)
|
208
|
+
query_parameters['smsTemplate'] = sms_template
|
209
|
+
end
|
210
|
+
|
211
|
+
body_parameters = {}
|
212
|
+
body_parameters['phone'] = phone
|
213
|
+
|
214
|
+
resource_path = 'identity/v2/auth/phone/otp'
|
215
|
+
post_request(resource_path, query_parameters, body_parameters)
|
216
|
+
end
|
217
|
+
|
218
|
+
# This API is used to update the login Phone Number of users
|
219
|
+
#
|
220
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
221
|
+
# @param phone - New Phone Number
|
222
|
+
# @param sms_template - SMS Template name
|
223
|
+
#
|
224
|
+
# @return Response Containing Validation Data and SMS Data
|
225
|
+
# 11.5
|
226
|
+
def update_phone_number(access_token, phone, sms_template = '')
|
227
|
+
if isNullOrWhiteSpace(access_token)
|
228
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
229
|
+
end
|
230
|
+
if isNullOrWhiteSpace(phone)
|
231
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
232
|
+
end
|
233
|
+
|
234
|
+
query_parameters = {}
|
235
|
+
query_parameters['access_token'] = access_token
|
236
|
+
query_parameters['apiKey'] = @api_key
|
237
|
+
unless isNullOrWhiteSpace(sms_template)
|
238
|
+
query_parameters['smsTemplate'] = sms_template
|
239
|
+
end
|
240
|
+
|
241
|
+
body_parameters = {}
|
242
|
+
body_parameters['phone'] = phone
|
243
|
+
|
244
|
+
resource_path = 'identity/v2/auth/phone'
|
245
|
+
put_request(resource_path, query_parameters, body_parameters)
|
246
|
+
end
|
247
|
+
|
248
|
+
# This API is used to check the Phone Number exists or not on your site.
|
249
|
+
#
|
250
|
+
# @param phone - The Registered Phone Number
|
251
|
+
#
|
252
|
+
# @return Response containing Definition Complete ExistResponse data
|
253
|
+
# 11.6
|
254
|
+
def check_phone_number_availability(phone)
|
255
|
+
if isNullOrWhiteSpace(phone)
|
256
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
257
|
+
end
|
258
|
+
|
259
|
+
query_parameters = {}
|
260
|
+
query_parameters['apiKey'] = @api_key
|
261
|
+
query_parameters['phone'] = phone
|
262
|
+
|
263
|
+
resource_path = 'identity/v2/auth/phone'
|
264
|
+
get_request(resource_path, query_parameters, nil)
|
265
|
+
end
|
266
|
+
|
267
|
+
# This API is used to delete the Phone ID on a user's account via the access token
|
268
|
+
#
|
269
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
270
|
+
#
|
271
|
+
# @return Response containing Definition of Delete Request
|
272
|
+
# 11.7
|
273
|
+
def remove_phone_id_by_access_token(access_token)
|
274
|
+
if isNullOrWhiteSpace(access_token)
|
275
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
276
|
+
end
|
277
|
+
|
278
|
+
query_parameters = {}
|
279
|
+
query_parameters['access_token'] = access_token
|
280
|
+
query_parameters['apiKey'] = @api_key
|
281
|
+
|
282
|
+
resource_path = 'identity/v2/auth/phone'
|
283
|
+
delete_request(resource_path, query_parameters, nil)
|
284
|
+
end
|
285
|
+
|
286
|
+
# This API registers the new users into your Cloud Storage and triggers the phone verification process.
|
287
|
+
#
|
288
|
+
# @param auth_user_registration_model - Model Class containing Definition of payload for Auth User Registration API
|
289
|
+
# @param sott - LoginRadius Secured One Time Token
|
290
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
291
|
+
# @param options - PreventVerificationEmail (Specifying this value prevents the verification email from being sent. Only applicable if you have the optional email verification flow)
|
292
|
+
# @param sms_template - SMS Template name
|
293
|
+
# @param verification_url - Email verification url
|
294
|
+
# @param welcome_email_template - Name of the welcome email template
|
295
|
+
#
|
296
|
+
# @return Response containing Definition of Complete Validation, UserProfile data and Access Token
|
297
|
+
# 17.1.2
|
298
|
+
def user_registration_by_phone(auth_user_registration_model, sott, fields = '', options = '', sms_template = '', verification_url = '', welcome_email_template = '')
|
299
|
+
if auth_user_registration_model.blank?
|
300
|
+
raise LoginRadius::Error.new, getValidationMessage('auth_user_registration_model')
|
301
|
+
end
|
302
|
+
if isNullOrWhiteSpace(sott)
|
303
|
+
raise LoginRadius::Error.new, getValidationMessage('sott')
|
304
|
+
end
|
305
|
+
|
306
|
+
query_parameters = {}
|
307
|
+
query_parameters['apiKey'] = @api_key
|
308
|
+
query_parameters['sott'] = sott
|
309
|
+
unless isNullOrWhiteSpace(fields)
|
310
|
+
query_parameters['fields'] = fields
|
311
|
+
end
|
312
|
+
unless isNullOrWhiteSpace(options)
|
313
|
+
query_parameters['options'] = options
|
314
|
+
end
|
315
|
+
unless isNullOrWhiteSpace(sms_template)
|
316
|
+
query_parameters['smsTemplate'] = sms_template
|
317
|
+
end
|
318
|
+
unless isNullOrWhiteSpace(verification_url)
|
319
|
+
query_parameters['verificationUrl'] = verification_url
|
320
|
+
end
|
321
|
+
unless isNullOrWhiteSpace(welcome_email_template)
|
322
|
+
query_parameters['welcomeEmailTemplate'] = welcome_email_template
|
323
|
+
end
|
324
|
+
|
325
|
+
resource_path = 'identity/v2/auth/register'
|
326
|
+
post_request(resource_path, query_parameters, auth_user_registration_model)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|