Skip to content

Commit 39a5b5c

Browse files
committed
[Portal] Docs: Get Users Docs (#6255)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the user experience by adding a new feature to fetch users through an API and updating the API endpoint for wallet pregeneration. ### Detailed summary - Added a new menu item `Fetch Users` in `sidebar.tsx`. - Updated the API endpoint in `page.mdx` for wallet pregeneration. - Introduced documentation for fetching users via REST API in `get-users/page.mdx`. - Provided example curl command and response format for the new feature. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 6f381d7 commit 39a5b5c

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

apps/portal/src/app/connect/sidebar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export const sidebar: SideBar = {
6363
name: "Sign-In Methods",
6464
href: `${walletSlug}/sign-in-methods/configure`,
6565
},
66+
{
67+
name: "Fetch Users",
68+
href: `${walletSlug}/get-users`,
69+
},
6670
{
6771
name: "Pregenerate Wallets",
6872
href: `${walletSlug}/pregenerate-wallets`,
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { Callout } from "@doc";
2+
import { createMetadata, ArticleIconCard } from "@doc";
3+
4+
export const metadata = createMetadata({
5+
image: {
6+
title: "Get Users",
7+
icon: "wallets",
8+
},
9+
title: "Get Users | thirdweb",
10+
description: "Learn how to fetch in-app wallet users for your application.",
11+
});
12+
13+
# Get Users
14+
15+
Once you have users connecting to your app through in-app wallets, you can fetch all users through our REST API:
16+
```
17+
https://in-app-wallet.thirdweb.com/api/v1/users
18+
```
19+
20+
## Headers
21+
22+
You need to include the following headers:
23+
24+
- `Content-Type`: Must be set to `application/json`
25+
- `x-secret-key`: Your secret key for authentication
26+
- `x-ecosystem-id` (optional): Your ecosystem ID
27+
- `x-ecosystem-partner-id` (optional): Your ecosystem partner ID
28+
29+
## Example curl Command
30+
31+
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
32+
33+
```bash
34+
curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/users?offset=200&limit=100' \
35+
-H 'x-secret-key: YOUR_SECRET_KEY' \
36+
-H 'Content-Type: application/json'
37+
```
38+
39+
Limit defaults to 100 users per request.
40+
41+
<Callout variant='info' title='Getting ecosystem users'>
42+
For ecosystem wallets, the secret key have to be from the same account as the ecosystem owner.
43+
</Callout>
44+
45+
46+
## Response Format
47+
48+
A successful API call returns an array of user objects in the following format:
49+
50+
```json
51+
[
52+
{
53+
"userId": "9841a5de-b4a6-44b3-ad14-c4b8745782ca",
54+
"walletAddress": "0x933F5BC72634c55b3643A6Aa0cD5b65ca4915d39",
55+
"createdAt": "2024-11-05T00:55:25.142Z",
56+
"authProvider": "google",
57+
"authDetails": {
58+
"id": "107302390467834615186",
59+
"name": "Richard Hendricks",
60+
"type": "google",
61+
"email": "[email protected]",
62+
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKC1D6ezzzaZxxUk4qtK_HCwVwpNamVopazXwklGBwuuHeSf_c=s96-c",
63+
"givenName": "Richard",
64+
"emailVerified": true
65+
},
66+
"email": "[email protected]",
67+
}
68+
]
69+
```
70+

apps/portal/src/app/connect/wallet/pregenerate-wallets/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ You need to include the following headers:
8484
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
8585

8686
```bash
87-
curl -X POST 'https://embedded-wallet.thirdweb.com/api/v1/pregenerate' \
87+
curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/pregenerate' \
8888
-H 'x-ecosystem-id: ecosystem.example-eco-123' \
8989
-H 'x-ecosystem-partner-id: 1415d24e-c7b0-4fce-846e-740841ef2c32' \
9090
-H 'x-secret-key: 9f8e7d6c5b4a3f2e1d0c9b8a7ffge434b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7' \
@@ -127,4 +127,4 @@ Pre-generating is independent and doesn't change the user's experience.
127127

128128
Your users can continue to login as per usual. When they do, they will be assigned the pregenerated wallet.
129129

130-
For more information on signing in, see [Sign In](/connect/wallet/sign-in-methods/configure).
130+
For more information on signing in, see [Sign In](/connect/wallet/sign-in-methods/configure).

0 commit comments

Comments
 (0)