@basiq/connect-auth 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -43
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1175 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1139 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,64 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# BASIQ CONNECT COMPONENT
|
|
2
2
|
|
|
3
3
|
The Basiq Connect Auth is a ReactJS UI component exposed to partners who prefer to implement the auth flow as an external component with an SMS OTP built in. When rendered, it will take the user through an SMS OTP flow and then proceed to redirect them to the [Basiq Consent UI](https://api.basiq.io/docs/consent-ui) flow to connect their accounts.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Note: This has been offered as interim solution for partners who require access to v3 of the API before we have released the upgrades to `https://connect.basiq.io/`. If you have any questions regarding this please reach out to support@basiq.io.
|
|
6
6
|
|
|
7
7
|
## Setup
|
|
8
8
|
|
|
9
9
|
1. Install `@basiq/connect-auth` and import the component
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
```
|
|
12
|
+
$ npm install @basiq/basiq-connect-control
|
|
13
|
+
```
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
```js
|
|
16
|
+
import { BasiqConnect } from "@basiq/connect-auth";
|
|
17
|
+
```
|
|
18
18
|
|
|
19
19
|
2. Generate a new Auth Link, and retrieve the auth link ID from the public URL that is returned.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
21
|
+
```js
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const { data } = await axios.get(
|
|
25
|
+
`https://au-api.basiq.io/users/{userId}/auth_link`,
|
|
26
|
+
{
|
|
27
|
+
method: 'post',
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${YOUR_SERVER_ACCESS_TOKEN}`,
|
|
30
|
+
Accept: 'application/json',
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
);
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
let auth_id = data.links.public.replace('https://connect.basiq.io/','');
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
return auth_id;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.log(error)
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
```
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
// Component rendered at /auth-link/:auth_id
|
|
46
|
+
3. Drop the component in your code on the page you wish to call it. The component will retrieve the auth_id from the URL so failing to include it there will result in an error. **Note** that the component is full page and will eventually handle the redirect to the Basiq Consent UI, so it should be rendered on it's own page (or conditionally, after appending an auth_link ID)
|
|
48
47
|
|
|
49
|
-
export default function Auth() {
|
|
50
|
-
return (
|
|
51
|
-
<main>
|
|
52
|
-
<BasiqConnect />
|
|
53
|
-
</main>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
48
|
|
|
58
|
-
|
|
49
|
+
```jsx
|
|
59
50
|
|
|
60
|
-
|
|
51
|
+
// Component rendered at /auth-link/:auth_id
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
export default function Auth() {
|
|
54
|
+
return (
|
|
55
|
+
<main>
|
|
56
|
+
<BasiqConnect />
|
|
57
|
+
</main>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
package/dist/index.d.mts
ADDED