In this section, you will find the components that can be used with by Unico
Loading...
Loading...
In this section, you will find information on how to redirect a user in your applications within the by Unico experience
he userRedirectUrl
field is used to direct the user. This field is received in the success response of the process creation when making the CreateProcess request.
Here you will find three ways to manage the user experience in web applications:
It is recommended to follow these steps:
In your common flow (which includes the by Unico Registration), you will redirect the client to the link generated through the API;
After that, the client within the platform carries out the necessary procedures to continue the flow;
When completed, they are redirected to your page (using the redirectUrl provided during the process creation).
window.open()
:The window.open() option consists of opening a new tab in the user's browser so that they can complete the process. At the end, this tab is closed and redirected to your application.
For this, it is recommended to:
ollow the public documentation on this, which can be found here;
Monitorar se houve alteração de URL (para a redirectUrl) e então fechar a aba utilizando window.close().
1 - Add the necessary dependency for using CustomTabs in your app/build.gradle:
Add the necessary permissions and intents in the AndroidManifest.xml for the Activity that you want to receive the callback_uri.
It is necessary to include the attribute android:launchMode="singleTop"
as well as the <data>
tag providing the URI data.
The following permissions are necessary for it to function correctly:
Camera
Geolocation
o retrieve redirect information with the provided data, you can use the following code in the onNewIntent
method of your Activity:
1 - O primeiro passo é criar o controlador de autenticação, e, para isso crie uma classe chamada UnicoAuthenticationController
(ou como preferir chamar).
2 - Na sequência, importe o framework AuthenticationServices
no topo da classe.
3 - Declare a classe como NSObject e implemente o protocolo ASWebAuthenticationPresentationContextProviding
.
O resultado deve ser:
1 - Abra o arquivo onde você executa a autenticação e adicione as importações necessárias (como exemplo, o ContentView.swift é usado).
2 - Para controlar o estado do fluxo é preciso criar a propriedade @State
.
3 - Crie uma instância da classe UnicoAuthenticationController
fora do corpo da estrutura ContentView.
4 - Para a validação do processo, crie uma função chamada redirectUser
.
Ambientes:
Lembre-se de alterar a url URL_AUTHENTICATION
para a URL de autenticação recebida em seu processo e também o callbackURLScheme BUNDLE
para o redirect informado na criação do processo (o uso do Bundle Identifier de seu aplicativo é recomendado).
Autenticação única:
É importante setar prefersEphemeralWebBrowserSession
para true para garantir uma autenticação única por processo.
Our support is limited to applications developed directly on the native Android and iOS platforms, using their respective native modules. At this time, we do not offer support for applications developed in hybrid frameworks, such as React Native, Ionic, or other cross-platform development technologies.
Still need help?
Didn't find something or still need help? If you're already a client or partner, you can reach out through our Help Center.
In this section, you will find information on how to implement the opening of by Unico through an iFrame in web journeys
The iFrame is widely used in web scenarios. To use by Unico through an iFrame, the first step is to register the domains that will be used as hosts to display the user journey iFrame in by Unico.
Please inform the person responsible for your integration project or the Unico support team to carry out this configuration.
To start using the iFrame, we must begin with the installation of the Unico web SDK. by Unico uses the same SDK that is used for IDPay:
This method initializes the SDK by preloading assets, creating a smoother experience for the end user. At this point, it is necessary to send the token received as a result of the CreateProcess.
Parameters:
options - an object with the following configuration properties:
type
The type of flow to be initialized. In by Unico, we use the "IFRAME" option.
token
Receives the token of the created process. This token is important to authenticate the journey and ensure that only authorized domains can use it (can be obtained when creating the process via API).
This method opens the by Unico experience. For the IFRAME flow, this function displays the already preloaded iFrame and initiates the messaging flow between the client page and the by Unico experience.
Parameters:
options - an object with configuration properties:
processId
Receives the ID of the created process. This ID is important to obtain the process details and carry out the entire flow correctly (can be obtained when creating the process via API).
token
Receives the token of the created process. This token is important to authenticate the journey and ensure that only authorized domains can use it (can be obtained when creating the process via API).
onFinish(process)
Receives a callback function that will be executed at the end of the by Unico journey, passing the process object with the following data: { captureConcluded, concluded, id }
.
The sequence diagram below demonstrates how to use the SDK and the API result from by Unico to configure the iFrame:
After careful analysis of our needs and challenges, we have decided to adopt a solution based on iframes with authentication tokens rather than implementing a Content Security Policy (CSP). This choice was motivated by various considerations related to the security and flexibility required to meet our clients' demands.
Content Security Policy (CSP) is a powerful tool for protecting web applications against various types of attacks, such as Cross-Site Scripting (XSS) and code injection. However, when configuring a CSP policy, it is necessary to define a strict list of trusted domains. This approach is effective when the domains are fixed and predictable. However, for our clients, who often use dynamic and variable domains, this rigid configuration presents significant challenges.
Dynamic domains pose a substantial security risk when using CSP. When a client has domains that frequently change or are created dynamically, it would be necessary to constantly update the CSP policy to include these new domains. This not only increases maintenance efforts but also exposes the domains to which the CSP policy applies. Each domain added to the CSP policy is potentially a vulnerability point if not adequately managed.
To mitigate these risks and meet the flexibility required by our clients, we opted to use iframes combined with authentication tokens. This solution provides an additional layer of security and avoids the need to expose or manage an extensive and dynamic list of domains.
Secure Authentication: Each iframe is loaded with a unique authentication token for each transaction, ensuring that only authorized users can access the content. This token is verified in real-time, providing an additional layer of security and control.
Content Isolation: The use of iframes allows for the isolation of content in a separate context, reducing the risk of interference between different origins and mitigating potential attacks.
Flexibility for Dynamic Domains: By not relying on a static CSP policy, our solution easily adapts to our clients' dynamic domains without the need for constant updates to security policies.
Still need help?
Didn't find something or still need help? If you're already a client or partner, you can reach out through our .