Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
bdd7419d3d | |||
0d99ee51d5 | |||
0f80623111 | |||
6c02861a79 | |||
a25e758faf | |||
14f2ba0692 | |||
0c391c1fd1 | |||
0c9decce3e | |||
edb3160f35 | |||
0eb51cf3c5 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/tink",
|
"name": "@mojoio/tink",
|
||||||
"version": "1.0.12",
|
"version": "1.0.17",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@mojoio/tink",
|
"name": "@mojoio/tink",
|
||||||
"version": "1.0.12",
|
"version": "1.0.17",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartrequest": "^1.1.56"
|
"@pushrocks/smartrequest": "^1.1.56"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/tink",
|
"name": "@mojoio/tink",
|
||||||
"version": "1.0.12",
|
"version": "1.0.17",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "an unofficial api abstraction for tink.com",
|
"description": "an unofficial api abstraction for tink.com",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -32,9 +32,9 @@ Use TypeScript for best inclass intellisense
|
|||||||
// this example assumes toplevel await
|
// this example assumes toplevel await
|
||||||
import * as tink from '@mojoio/tink';
|
import * as tink from '@mojoio/tink';
|
||||||
|
|
||||||
const tinkAccount = new TinkAccount('clientId', 'clientSecret');
|
const tinkAccount = new TinkAccount('<clientId>', '<clientSecret>');
|
||||||
const tinkUser = await tinkAccount.createTinkUser('YourOwnUniqueUserId');
|
const tinkUser = await tinkAccount.createTinkUser('<YourOwnUniqueUserId/externalUserId>');
|
||||||
const tinkLinkUrl = await tinkUser.getTinkLink();
|
const tinkLinkUrl = await tinkUser.getTinkLink('<marketCode like DE>');
|
||||||
|
|
||||||
// present the link to your user to connect their bank accounts to the tink platform.
|
// present the link to your user to connect their bank accounts to the tink platform.
|
||||||
|
|
||||||
@ -47,6 +47,9 @@ for (const providerConsent of tinkProviderConsents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// additional stuff
|
||||||
|
const existingTinkUser = await tinkAccount.getUser('<YourOwnUniqueUserId/externalUserId>')
|
||||||
|
await existingTinkuser.delete(); // delete the user on the tink platform
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
export * from './tink.classes.tinkaccount';
|
export * from './tink.classes.tinkaccount';
|
||||||
export * from './tink.classes.tinkuser';
|
export * from './tink.classes.tinkuser';
|
||||||
|
export * from './tink.classes.tinkproviderconsent';
|
@ -4,13 +4,13 @@ import { TinkUser } from './tink.classes.tinkuser';
|
|||||||
|
|
||||||
export class TinkAccount {
|
export class TinkAccount {
|
||||||
public clientId: string;
|
public clientId: string;
|
||||||
private clientSecret: string;
|
private _clientSecret: string;
|
||||||
|
|
||||||
private apiBaseUrl: string = 'https://api.tink.com';
|
private _apiBaseUrl: string = 'https://api.tink.com';
|
||||||
|
|
||||||
constructor(clientIdArg: string, clientSecretArg: string) {
|
constructor(clientIdArg: string, clientSecretArg: string) {
|
||||||
this.clientId = clientIdArg;
|
this.clientId = clientIdArg;
|
||||||
this.clientSecret = clientSecretArg;
|
this._clientSecret = clientSecretArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getTinkHealthyBoolean(): Promise<boolean> {
|
public async getTinkHealthyBoolean(): Promise<boolean> {
|
||||||
@ -26,7 +26,7 @@ export class TinkAccount {
|
|||||||
public async getClientAccessTokenForScope(scopeArg: string): Promise<string> {
|
public async getClientAccessTokenForScope(scopeArg: string): Promise<string> {
|
||||||
// lets get an accessToken for the request
|
// lets get an accessToken for the request
|
||||||
const response = await plugins.smartrequest.postFormDataUrlEncoded(
|
const response = await plugins.smartrequest.postFormDataUrlEncoded(
|
||||||
`${this.apiBaseUrl}/api/v1/oauth/token`,
|
`${this._apiBaseUrl}/api/v1/oauth/token`,
|
||||||
{
|
{
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
},
|
},
|
||||||
@ -37,7 +37,7 @@ export class TinkAccount {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'client_secret',
|
key: 'client_secret',
|
||||||
content: this.clientSecret,
|
content: this._clientSecret,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'grant_type',
|
key: 'grant_type',
|
||||||
@ -65,7 +65,7 @@ export class TinkAccount {
|
|||||||
) {
|
) {
|
||||||
const accessToken = await this.getClientAccessTokenForScope('authorization:grant');
|
const accessToken = await this.getClientAccessTokenForScope('authorization:grant');
|
||||||
const response = await plugins.smartrequest.postFormDataUrlEncoded(
|
const response = await plugins.smartrequest.postFormDataUrlEncoded(
|
||||||
`${this.apiBaseUrl}/api/v1/oauth/authorization-grant/delegate`,
|
`${this._apiBaseUrl}/api/v1/oauth/authorization-grant/delegate`,
|
||||||
{
|
{
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
headers: {
|
headers: {
|
||||||
@ -107,7 +107,7 @@ export class TinkAccount {
|
|||||||
public async getUserAccessToken(authorizationCode: string): Promise<string> {
|
public async getUserAccessToken(authorizationCode: string): Promise<string> {
|
||||||
const accessToken = await this.getClientAccessTokenForScope('authorization:grant');
|
const accessToken = await this.getClientAccessTokenForScope('authorization:grant');
|
||||||
const response = await plugins.smartrequest.postFormDataUrlEncoded(
|
const response = await plugins.smartrequest.postFormDataUrlEncoded(
|
||||||
`${this.apiBaseUrl}/api/v1/oauth/token`,
|
`${this._apiBaseUrl}/api/v1/oauth/token`,
|
||||||
{
|
{
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
},
|
},
|
||||||
@ -122,7 +122,7 @@ export class TinkAccount {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'client_secret',
|
key: 'client_secret',
|
||||||
content: this.clientSecret,
|
content: this._clientSecret,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'grant_type',
|
key: 'grant_type',
|
||||||
@ -153,7 +153,7 @@ export class TinkAccount {
|
|||||||
} else {
|
} else {
|
||||||
console.log('tink is healthy, continuing...');
|
console.log('tink is healthy, continuing...');
|
||||||
}
|
}
|
||||||
const response = await plugins.smartrequest.request(`${this.apiBaseUrl}${optionsArg.urlArg}`, {
|
const response = await plugins.smartrequest.request(`${this._apiBaseUrl}${optionsArg.urlArg}`, {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${optionsArg.accessToken}`,
|
Authorization: `Bearer ${optionsArg.accessToken}`,
|
||||||
|
@ -80,8 +80,6 @@ export class TinkUser {
|
|||||||
public tinkUserId: string;
|
public tinkUserId: string;
|
||||||
public externalUserIdArg: string;
|
public externalUserIdArg: string;
|
||||||
|
|
||||||
public authorizationToken: string;
|
|
||||||
|
|
||||||
constructor(tinkAccountrefArg: TinkAccount, tinkUserIdArg: string, externalUserIdArg: string) {
|
constructor(tinkAccountrefArg: TinkAccount, tinkUserIdArg: string, externalUserIdArg: string) {
|
||||||
this.tinkAccountRef = tinkAccountrefArg;
|
this.tinkAccountRef = tinkAccountrefArg;
|
||||||
this.tinkUserId = tinkUserIdArg;
|
this.tinkUserId = tinkUserIdArg;
|
||||||
|
Reference in New Issue
Block a user