Skip to content

Commit 290eddf

Browse files
ruvenzxtomski747
andauthored
add jwt sign up or in to readme (#188)
* add jwt sign up or in to readme * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Tom Kaminski <tom@descope.com>
1 parent 30111dc commit 290eddf

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,41 @@ try {
11901190
} catch (DescopeException de) {
11911191
// Handle the error
11921192
}
1193+
```
1194+
Generate a JWT for a user, simulating a signin request.
1195+
1196+
```java
1197+
JwtService jwtService = descopeClient.getManagementServices().getJwtService();
1198+
LoginOptions loginOptions = new LoginOptions();
1199+
loginOptions.setCustomClaims(new HashMap<String, Object>() {{
1200+
put("custom-key1", "custom-value1");
1201+
put("custom-key2", "custom-value2");
1202+
}});
1203+
AuthenticationInfo res = jwtService.signIn("dummy", loginOptions);
1204+
```
1205+
1206+
Generate a JWT for a user, simulating a signup request.
11931207

1208+
```java
1209+
JwtService jwtService = descopeClient.getManagementServices().getJwtService();
1210+
MgmtSignUpUser mgmtSignUpUser = new MgmtSignUpUser();
1211+
mgmtSignUpUser.setCustomClaims(new HashMap<String, Object>() {{
1212+
put("custom-key1", "custom-value1");
1213+
put("custom-key2", "custom-value2");
1214+
}});
1215+
AuthenticationInfo res = jwtService.signUp("Dummy", mgmtSignUpUser);
1216+
```
1217+
1218+
Generate a JWT for a user, simulates a signup or in request.
1219+
1220+
```java
1221+
JwtService jwtService = descopeClient.getManagementServices().getJwtService();
1222+
MgmtSignUpUser mgmtSignUpUser = new MgmtSignUpUser();
1223+
mgmtSignUpUser.setCustomClaims(new HashMap<String, Object>() {{
1224+
put("custom-key1", "custom-value1");
1225+
put("custom-key2", "custom-value2");
1226+
}});
1227+
AuthenticationInfo res = jwtService.signUpOrIn("Dummy", mgmtSignUpUser);
11941228
```
11951229

11961230
### Audit

0 commit comments

Comments
 (0)