-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathauth-tokens-example.tsx
More file actions
37 lines (33 loc) · 863 Bytes
/
auth-tokens-example.tsx
File metadata and controls
37 lines (33 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import { IntercomProvider, useIntercom } from 'react-use-intercom';
function MyApp() {
const { boot } = useIntercom();
const handleLogin = () => {
// After successful login, boot Intercom with auth tokens
boot({
email: '[email protected]',
createdAt: 1234567890,
name: 'John Doe',
userId: '9876',
authTokens: {
security_token: 'abc...', // Your JWT token
// You can add any other tokens as key-value pairs
api_token: 'xyz...',
custom_token: '123...'
}
});
};
return (
<div>
<h1>Intercom Auth Tokens Example</h1>
<button onClick={handleLogin}>Login and Boot Intercom</button>
</div>
);
}
export default function App() {
return (
<IntercomProvider appId="your-app-id">
<MyApp />
</IntercomProvider>
);
}