20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/revolut/api/private/auth.rb', line 20
def confirm_signin(phone:, code:)
data = {
phone: phone,
code: code.gsub("-", "")
}
options = {
check_configuration: false,
authenticate: false
}
response = post("signin/confirm", data: data, options: options)
auth_data = {id: response&.dig("user", "id"), access_token: response&.fetch("accessToken", nil)}
auth_data.delete_if { |key, value| value.to_s.empty? }
if !auth_data.empty?
self.configuration.user_id = auth_data.fetch(:id, nil)
self.configuration.access_token = auth_data.fetch(:access_token, nil)
else
auth_data = nil
end
return auth_data
end
|