Effortlessly integrate v0 with Yodlee using our step-by-step guide. Discover how to streamline account aggregation, boost security, and empower your financial app.
Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
yodleeConfig.ts
in your project root directory.yodleeConfig.ts
and replace the placeholder values with your actual credentials.
export const YODLEE_CONFIG = {
baseUrl: "https://developer.api.yodlee.com/ysl",
clientId: "YOURCLIENTID", // Replace with your Yodlee Client ID
secret: "YOUR_SECRET", // Replace with your Yodlee Secret
cobrandLogin: "YOURCOBRANDLOGIN", // Replace with your Cobrand Login
cobrandPassword: "YOURCOBRANDPASSWORD" // Replace with your Cobrand Password
};
YodleeService.ts
in your project directory.YodleeService.ts
.
import { YODLEE_CONFIG } from "./yodleeConfig";
export class YodleeService {
private cobrandSession: string | null = null;
private userSession: string | null = null;
// Function to authenticate cobrand
public async authenticateCobrand(): Promise {
const url = ${YODLEE_CONFIG.baseUrl}/cobrand/login;
const payload = {
cobrand: {
cobrandLogin: YODLEE_CONFIG.cobrandLogin,
cobrandPassword: YODLEE_CONFIG.cobrandPassword,
locale: "en_US"
}
};
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Api-Version": "1.1"
},
body: JSON.stringify(payload)
});
const data = await response.json();
this.cobrandSession = data.cobSession;
}
// Function to authenticate user (requires prior cobrand authentication)
public async authenticateUser(username: string, password: string): Promise {
if (!this.cobrandSession) {
throw new Error("Cobrand not authenticated. Call authenticateCobrand first.");
}
const url = ${YODLEE_CONFIG.baseUrl}/user/login;
const payload = {
user: {
loginName: username,
password: password
}
};
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Api-Version": "1.1",
"Cobrand-Session": this.cobrandSession
},
body: JSON.stringify(payload)
});
const data = await response.json();
this.userSession = data.userSession;
}
// Function to fetch user accounts from Yodlee
public async getAccounts(): Promise {
if (!this.cobrandSession || !this.userSession) {
throw new Error("Sessions not established. Ensure both cobrand and user are authenticated.");
}
const url = ${YODLEE_CONFIG.baseUrl}/accounts;
const response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Api-Version": "1.1",
"Cobrand-Session": this.cobrandSession,
"User-Session": this.userSession
}
});
return response.json();
}
}
main.ts
) where you want to integrate the Yodlee functionality.YodleeService
class to authenticate and fetch user account data.
import { YodleeService } from "./YodleeService";
// Immediately Invoked Async Function Expression for initialization
(async () => {
const yodlee = new YodleeService();
try {
// Step 1: Authenticate the cobrand using your Yodlee credentials
await yodlee.authenticateCobrand();
// Step 2: Authenticate the user
// Replace "userLogin" and "userPassword" with real user credentials or obtain them from your UI
await yodlee.authenticateUser("userLogin", "userPassword");
// Step 3: Fetch user accounts and log them to the console
const accounts = await yodlee.getAccounts();
console.log("Accounts:", accounts);
} catch (error) {
console.error("Error during Yodlee integration:", error);
}
})();
fetch
API (for example, if it runs in environments where fetch
is not available), insert the following snippet into your main HTML file within the <head>
section:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fetch.umd.js"></script>
yodleeConfig.ts
, YodleeService.ts
, and your modifications in main.ts
) are saved in your project.When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.