How can I connect with Sumsub?

  • Goal: Make API calls to Sumsub endpoints

  • Steps: Before make any API call to Sumsub endpoints, I have to create a signature in HEX format and also I have to get the number of seconds since Unix Epoch. I have to create this logic as a template for any kind of query to Sumsub endpoints.
    Where can I add this javascript logic in order to be executed before each call?

Sumsub doc: Authentication

2 Likes

Hi @Dario! Welcome to the community. :slightly_smiling_face:

I thought this would be a straightforward problem to solve, but it ended up being more intricate than I expected. At a high level, you should define a custom authentication flow on the resource itself in order to avoid having to redefine these headers on every single request.

You'll then reference those variables in the resource's headers.

The somewhat tricky part is that you need to also define a refresh flow that recalculates the value of these variables on every request.

I know that's a lot, but it should do what you need it to do! Let me know if you have any follow-up questions.

1 Like

Hello Darren!!!

Thank you for your reply!!! Let me test it and I will back you!

Kind regards!

1 Like

Hello,

I have a couple of questions:

  • Can I return an array in my response with both variables? I think so but could you clarify it to me please. Like "return [signature, timestamp]
  • To create the signature, I have to access to the current URL. What is the javascript variable where I can get the current method and the current URL?
  • I need some javascript libraries like "crypto" for HMACSHA256 encryption. I know that I can add some Libraries from settings in each App, but how can I test it from custom flow?

@Darren