# User management

Use `User` methods to manage the current user's account. You can access the current user with `clerk.user`.

### Reload user

```swift
let refreshedUser = try await user.reload()
```

### Update user

```swift
let updatedUser = try await user.update(.init(
  username: "janedoe",
  firstName: "Jane",
  lastName: "Doe"
))
```

### Create email address

```swift
let emailAddress = try await user.createEmailAddress("jane@example.com")
```

### Create phone number

```swift
let phoneNumber = try await user.createPhoneNumber("+15551234567")
```

### Create external account with OAuth

Create an external account with an OAuth provider (e.g., Google, GitHub, see [all providers](https://clerk.com/docs/ios/guides/configure/auth-strategies/social-connections/overview.md#supported-social-providers)):

```swift
let externalAccountOAuth = try await user.createExternalAccount(
  provider: .google,
  redirectUrl: "myapp://callback",
  additionalScopes: ["email", "profile"]
)
```

### Create external account with ID token

```swift
let externalAccountIDToken = try await user.createExternalAccount(
  provider: .apple,
  idToken: idToken
)
```

### Create passkey

```swift
let passkey = try await user.createPasskey()
```

### Create TOTP secret

```swift
let totp = try await user.createTOTP()
```

### Verify TOTP code

```swift
let verifiedTotp = try await user.verifyTOTP(code: "123456")
```

### Disable TOTP

```swift
let deletedTotp = try await user.disableTOTP()
```

### Create backup codes

```swift
let backupCodes = try await user.createBackupCodes()
```

### Connect Apple account

```swift
let appleAccount = try await user.connectAppleAccount()
```

### List Organization invitations

```swift
let response = try await user.getOrganizationInvitations(
  page: 1,
  pageSize: 20,
  status: ["pending"]
)

let organizationInvitations = response.data
```

### List Organization memberships

```swift
let response = try await user.getOrganizationMemberships(
  page: 1,
  pageSize: 20
)

let organizationMemberships = response.data
```

### List Organization suggestions

```swift
let response = try await user.getOrganizationSuggestions(
  page: 1,
  pageSize: 20,
  status: ["pending"]
)

let organizationSuggestions = response.data
```

### Get Organization creation defaults

```swift
let organizationCreationDefaults = try await user.getOrganizationCreationDefaults()
```

### List sessions

```swift
let sessions = try await user.getSessions()
```

### Update user password

```swift
let updatedPassword = try await user.updatePassword(
  .init(
    currentPassword: "old-password",
    newPassword: "new-password",
    signOutOfOtherSessions: true
  )
)
```

### Set profile image

```swift
let profileImage = try await user.setProfileImage(imageData: imageData)
```

### Delete profile image

```swift
let deletedProfileImage = try await user.deleteProfileImage()
```

### Delete user

```swift
let deletedUser = try await user.delete()
```

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
