Closed yh2015 closed 3 years ago
Hello @yh2015 . Thank you for your contribution. Please pay attention to next code snippet:
let params = SECustomerParams(identifier: "your-customer-unique-id")
SERequestManager.shared.createCustomer(with: params) { response in
switch response {
case .success(let value):
// Save customer secret to your storage
UserDefaultsHelper.customerSecret = value.data.secret
SERequestManager.shared.set(customerSecret: value.data.secret)
case .failure(let error):
// Handle error
}
}
After receiving of customer secret for future rest calls you should save it (e.g. in UserDefault), otherwise you may receive invalid customer id
.
Hope advice was helpful.
Thank for answering @ConstantinKV, I am saving the customer secret. That's not the issue, my problem is: how can I use the incoming data (secret) in the next call when I try to create a session. No place for customer Id in the SEConnectSessionsParams. Should the secret be saved in a specific location where it can be sent automatically when I use createConnectSession(params: connectSessionsParams), because even after saving the secret customer Id is still empty.
@yh2015 After you receive the customer secret
, you should link it with the SERequestManager
, like this:
SERequestManager.shared.set(customerSecret: "received-customer-secret-here")
Check this method here.
By doing this you will set the Customer-secret
HTTP header and all outgoing requests will have the proper customer-related HTTP headers set by default.
Thanks for replying @baller784, actually I am working with a client that provides the customer Id, in case I received this error Customer with identifier: '****' already exists. how can I connect to a session while not being able to save theshared secret since the creation wasn't successful and I didn't save the secret.
@yh2015 There is no way to create a connection without a customer secret
. Before creating a connection, you should check whether you have the customer secret
and linked it to SERequestManager
, which you can use for future requests.
You can do one of the following:
customer secret
with a new specific customer id
and then use the new received customer secret
.customer secret
with already existing customer id
, you may try to remove this customer in your Salt Edge Dashboard and then recreate customer in your app.But, make sure to check every time, whether you have the customer secret
and you have linked it to SERequestManager
.
Please, check the docs:
Thank you for the clear answer @baller784.
let connectSessionsParams = SEConnectSessionsParams( attempt: SEAttempt(returnTo: "https://www.google.com"), javascriptCallbackType: "iframe", consent: SEConsent(scopes: ["account_details", "transactions_details"]) )
After successfully creating a customer, trying to connect to a session is failing because of an invalid customer id. I cannot find a param for sending the customer id. How should I add it to the API call?