Skip to content

Commit

Permalink
auth
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaarbonel committed Sep 18, 2024
1 parent 643dcc3 commit 8296e4e
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docusaurus/video/docusaurus/docs/api/basics/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ client.upsert_users(
)
```

</TabItem>
<TabItem value="go" label="Golang">

```go
client.UpdateUsers(ctx, &UpdateUsersRequest{
Users: map[string]UserRequest{
"user_id": {
Role: PtrTo("user"),
Custom: &map[string]interface{}{
"color": "red",
},
Name: PtrTo("This is a test user"),
Image: PtrTo("link/to/profile/image"),
},
},
})

```

</TabItem>
<TabItem value="curl" label="cURL">

Expand Down Expand Up @@ -162,6 +181,37 @@ client.update_users_partial(
)
```

</TabItem>
<TabItem value="go" label="Golang">

```go
client.UpdateUsers(ctx, &UpdateUsersRequest{
Users: map[string]UserRequest{
"user_id": {
Role: PtrTo("user"),
Custom: &map[string]interface{}{
"color": "red",
},
Name: PtrTo("This is a test user"),
Image: PtrTo("link/to/profile/image"),
},
},
})

// or
client.UpdateUsersPartial(ctx, &UpdateUsersPartialRequest{
Users: []UpdateUserPartialRequest{
{
ID: "user_id",
Set: &map[string]interface{}{
"color": "blue",
},
Unset: &[]string{"name"},
},
},
})
```

</TabItem>
<TabItem value="curl" label="cURL">

Expand Down Expand Up @@ -371,6 +421,23 @@ call_cids = ["default:call1", "livestream:call2"]
client.create_call_token(user_id=user_id, expiration=exp, call_cids=call_cids)
```

</TabItem>
<TabItem value="go" label="Golang">

```go
userID := "john"

// exp and iat are optional, token will be valid for 1 hour
exp := time.Now().Add(1 * time.Hour)

callCIDs := []string{"default:call1", "livestream:call2"}

client.CreateToken(userID, &StreamJWTClaims{
Expire: &exp,
CallCIDs: callCIDs,
})
```

</TabItem>

<TabItem value="bash" label="Bash">
Expand Down

0 comments on commit 8296e4e

Please sign in to comment.