The UI Components can be integrated into React Native applications, provide an html snippet as a source to your WebView component, that includes the SDK import and the call to any of the renderXXX methods.
The mobile integration would need an explicit setting of the OAuth token before rendering the component.
The token can be obtained from iCreditWorks OAuth endpoint by providing the given partner credentials.
Request
POST https://apiuat.icreditworks.com/api/security/partner/v1/session/start
{
"appId": "<<Partner_Id>>",
"appPwd": "<<Parner_Secret>>"
}
Response
{
"status": "OK",
"message": "success",
"resultMap": {
"expiresOn": "2023-10-03T14:03:24.238+00:00",
"accessToken": "<<OAUTH_TOKEN>>",
"tokenLife": 3600,
"refreshToken": "<<Refresh_Token>>"
}
}
The accessToken attribute from the response is used to set the oauth token to the SDK.
icw.setOAuthToken('<<OAUTH-TOKEN>>');
import { StyleSheet, SafeAreaView } from 'react-native';
import { WebView } from 'react-native-webview';
export default function App() {
return (
<SafeAreaView style={{ flex: 1 }}>
<WebView
id='skygenWebView'
javaScriptEnabled={true}
style={{ flex: 1 }}
source={require('./index.html')} />
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
<!doctype html>
<html lang="en">
<head>
<script data-icw-sdk
src="https://assets.icreditworks.com/public/paas/icw-sdk-new.js?client_public_id=c2bf8c30-e090-11ea-8334-06e9a0fb50c7"></script>
<script>
const ICW_PARTNER_AUTH_URI = "https://apiuat.icreditworks.com/api/security/partner/v1/session/start";
const PARTNER_ID = "<< YOUR_PARTNER_ID >>";
const PARTNER_SECRET = "<< YOUR_PARTNER_SECRET>>";
async function authenticate() {
const response = await fetch(ICW_PARTNER_AUTH_URI , {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ appId: PARTNER_ID , appPwd: PARTNER_SECRET})
});
let data = await response.json();
let accessToken = data.resultMap.accessToken;
return accessToken;
}
async function loadPrequalPage() {
// Step-1: Get the OAuth Token
let oAuthToken = await authenticate();
// Step-2: Set the Token to SDK
icw.setOAuthToken(oAuthToken);
// Step-3: Render the Component
await icw.renderPreQualForm(
"icwcontainer",
{
firstName: "ALLISON",
lastName: "EDSALL",
address1: "3107 SEYMOUR LAKE RD",
city: "OXFORD",
state: "MI",
zipCode: "48371",
dateOfBirth: "04/01/1972",
annualIncome: 60000.0,
amount: 5000.0,
ssn: "666504113",
}
);
}
</script>
</head>
<body>
<div style="margin-top:200px;text-align:center;"></div>
<h3>ICW PaaS Integration Demo: Loan Application Form</h3>
<div class="prequal-button">
<button class="btn btn_orange" id="icw-btn-1" onclick="loadPrequalPage()">Load Pre-Qual</button>
</div>
<div class="place-holder" id="icwcontainer">
Place Holder....
</div>
</body>
</html>