Skip to content

Commit 4a4fb7b

Browse files
[Connect] Redesign sidebar and update wallet documentation
1 parent 8b6a953 commit 4a4fb7b

File tree

10 files changed

+1711
-584
lines changed

10 files changed

+1711
-584
lines changed

apps/portal/src/app/connect/account-abstraction/get-started/page.mdx

Lines changed: 95 additions & 315 deletions
Large diffs are not rendered by default.
-867 KB
Binary file not shown.

apps/portal/src/app/connect/in-app-wallet/custom-auth/configuration/page.mdx

Lines changed: 99 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,30 @@ import EWCustomAuthdb2 from "../images/customauthdb2.png";
1212

1313
export const metadata = createMetadata({
1414
image: {
15-
title: "Configure Authentication for In-App Wallet",
15+
title: "Bring your own auth",
1616
icon: "wallets",
1717
},
18-
title: "Configure Authentication In-App Wallet | thirdweb",
18+
title: "Bring your own auth | thirdweb",
1919
description:
20-
"Configure Authentication with OIDC standard, OR a generic option that lets you bring your own auth server",
20+
"Configure in-app wallets with OIDC standard, or a generic endpoint that lets you bring your own auth server",
2121
});
2222

23-
# Configuration
23+
# Bring your own auth
2424

25-
We offer two options to setup in-app wallets with custom auth, one that is based on the [OIDC (Open ID Connect)](https://openid.net/developers/how-connect-works/) standard, and a generic option that lets you bring your own auth server. You can also use both options together if needed.
25+
You can attach wallets to your existing users using the `jwt` and `auth_endpoint` strategies.
2626

27-
## OIDC compatible auth
27+
- The `jwt` strategy is based on the [OIDC (Open ID Connect)](https://openid.net/developers/how-connect-works/) standard
28+
- The `auth_endpoint` strategy is a generic option that lets you bring your own auth server.
29+
30+
<Tabs defaultValue="jwt">
31+
<TabsList>
32+
<TabsTrigger value="jwt">JWT (OICD)</TabsTrigger>
33+
<TabsTrigger value="auth_endpoint">Auth endpoint</TabsTrigger>
34+
</TabsList>
35+
36+
<TabsContent value="jwt">
37+
38+
## Strategy `jwt` - OIDC compatible auth
2839

2940
The OIDC auth set-up is a good option if you use an external auth provider like `Auth0`, `firebase`, `cognito` etc. that publishes the JWK for checking the authenticity of the token.
3041

@@ -44,12 +55,13 @@ You will be asked to enter the following values
4455
- The URL of the JWKS file (public key): This is used to verify the token was signed by you.
4556
- The `aud` value of the idToken: This is used to verify that thirdweb is the intended user of the token
4657

47-
### Authenticating a user via OIDC-compatible auth
58+
### Usage example
4859

49-
<Tabs defaultValue="react">
60+
<Tabs defaultValue="typescript">
5061
<TabsList>
51-
<TabsTrigger value="react">React</TabsTrigger>
5262
<TabsTrigger value="typescript">TypeScript</TabsTrigger>
63+
<TabsTrigger value="react">React</TabsTrigger>
64+
<TabsTrigger value="dotnet">.NET</TabsTrigger>
5365
</TabsList>
5466

5567
<TabsContent value="react">
@@ -58,19 +70,29 @@ You will be asked to enter the following values
5870
import { inAppWallet } from "thirdweb/wallets";
5971
import { useConnect } from "thirdweb/react";
6072

61-
const { connect } = useConnect();
73+
const client = createThirdwebClient({ clientId: "your-client-id" });
74+
const wallet = inAppWallet();
75+
76+
const MyComponent = () => {
77+
const { connect } = useConnect();
6278

63-
const handlePostLogin = async (jwt: string) => {
79+
const handlePostLogin = async () => {
6480
await connect(() => {
65-
const wallet = inAppWallet();
6681
wallet.connect({
6782
client,
6883
strategy: "jwt",
69-
jwt,
84+
jwt: "<your-jwt-token>",
7085
});
7186
return wallet;
7287
});
7388
};
89+
90+
return (
91+
<button onClick={() => handlePostLogin()}>
92+
Login
93+
</button>
94+
);
95+
};
7496
```
7597

7698
</TabsContent>
@@ -85,16 +107,33 @@ const wallet = inAppWallet();
85107
const account = await wallet.connect({
86108
client,
87109
strategy: "jwt",
88-
jwt,
110+
jwt: "<your-jwt-token>",
89111
});
90112

91113
// use the account to send transactions
92114
```
93115

94116
</TabsContent>
117+
118+
<TabsContent value="dotnet">
119+
120+
```csharp
121+
using Thirdweb;
122+
123+
var client = ThirdwebClient.Create(clientId: "your-client-id");
124+
var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.JWT);
125+
var address = await wallet.LoginWithCustomAuth(jwt: "<your-jwt-token>");
126+
```
127+
128+
</TabsContent>
129+
95130
</Tabs>
96131

97-
## Generic auth
132+
</TabsContent>
133+
134+
<TabsContent value="auth_endpoint">
135+
136+
## Strategy `auth_endpoint` - Generic auth
98137

99138
Generic auth is a lower-level option that can be used when you have your own auth server that you use to authenticate users.
100139

@@ -127,35 +166,47 @@ The endpoint should return a JSON body containing the following fields:
127166

128167
You can also pass a list of headers. These headers will be sent with every request to your verification endpoint. You can use these to authenticate the request.
129168

130-
### Authenticating a user via generic auth
169+
### Usage example
131170

132171
Once you've logged in with your own auth, you can pass the user's JWT to the in-app wallet to authenticate and connect.
133172

134-
<Tabs defaultValue="react">
173+
<Tabs defaultValue="typescript">
135174
<TabsList>
136-
<TabsTrigger value="react">React</TabsTrigger>
137175
<TabsTrigger value="typescript">TypeScript</TabsTrigger>
176+
<TabsTrigger value="react">React</TabsTrigger>
177+
<TabsTrigger value="dotnet">.NET</TabsTrigger>
138178
</TabsList>
139179

140180
<TabsContent value="react">
141181

142182
```typescript
183+
import { createThirdwebClient } from "thirdweb";
143184
import { inAppWallet } from "thirdweb/wallets";
144185
import { useConnect } from "thirdweb/react";
145186

146-
const { connect } = useConnect();
187+
const client = createThirdwebClient({ clientId: "your-client-id" });
188+
const wallet = inAppWallet();
147189

148-
const handlePostLogin = async (jwt: string) => {
149-
await connect(async () => {
150-
const wallet = inAppWallet();
151-
await wallet.connect({
152-
client,
153-
strategy: "auth_endpoint",
154-
// This is the payload that is sent to the auth endpoint
155-
payload,
190+
const MyComponent = () => {
191+
const { connect } = useConnect();
192+
193+
const handlePostLogin = async () => {
194+
await connect(async () => {
195+
await wallet.connect({
196+
client,
197+
strategy: "auth_endpoint",
198+
// This is the payload that will be sent to your auth endpoint
199+
payload: "<your-auth-payload>",
200+
});
201+
return wallet;
156202
});
157-
return wallet;
158-
});
203+
};
204+
205+
return (
206+
<button onClick={() => handlePostLogin()}>
207+
Login
208+
</button>
209+
);
159210
};
160211
```
161212

@@ -173,12 +224,29 @@ const wallet = inAppWallet();
173224
const account = await wallet.connect({
174225
client,
175226
strategy: "auth_endpoint",
176-
// This is the payload that is sent to the auth endpoint
177-
payload,
227+
// This is the payload that will be sent to your auth endpoint
228+
payload: "<your-auth-payload>",
178229
});
179230

180231
// use the account to send transactions
181232
```
182233

183234
</TabsContent>
235+
236+
<TabsContent value="dotnet">
237+
238+
```csharp
239+
using Thirdweb;
240+
241+
var client = ThirdwebClient.Create(clientId: "your-client-id");
242+
var wallet = await InAppWallet.Create(client: client, authProvider: AuthProvider.AuthEndpoint);
243+
var address = await wallet.LoginWithAuthEndpoint(payload: "<your-auth-payload>");
244+
```
245+
246+
</TabsContent>
247+
248+
</Tabs>
249+
250+
</TabsContent>
251+
184252
</Tabs>

0 commit comments

Comments
 (0)