# Update User — OneLogin

> Update an existing user's details in OneLogin. See the documentation

- Key: `onelogin-update-user`
- Type: Action (Write)
- Version: 0.0.2
- App: OneLogin (`onelogin`) — https://pipedream.com/apps/onelogin.md
- This page (HTML): https://pipedream.com/apps/onelogin/actions/update-user
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/onelogin/actions/update-user/update-user.mjs

## Description

Update an existing user's details in OneLogin. [See the documentation](https://developers.onelogin.com/api-docs/2/users/update-user)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `userId` | `string` | Yes | The ID of the user Options are loaded from the connected account. |
| `username` | `string` | No | The user's username |
| `email` | `string` | No | The user's email address |
| `firstname` | `string` | No | The user's first name |
| `lastname` | `string` | No | The user's last name |
| `password` | `string` | No | The password to set for the user |
| `passwordConfirmation` | `string` | No | Required if the password is being set |
| `passwordAlgorithm` | `string` | No | Use this when importing a password that's already hashed. See the documentation for further information |
| `salt` | `string` | No | The salt value used with the Password Algorithm |
| `title` | `string` | No | The user's job title |
| `department` | `string` | No | The user's department |
| `company` | `string` | No | The user's company |
| `comment` | `string` | No | Free text related to the user |
| `groupId` | `integer` | No | The ID of the Group in OneLogin that the user will be assigned to Options are loaded from the connected account. |
| `roleIds` | `integer[]` | No | A list of OneLogin Role IDs the user will be assigned to Options are loaded from the connected account. |
| `phone` | `string` | No | The E.164 format phone number for a user |
| `state` | `string` | No | The user's state |
| `status` | `string` | No | The user's status |
| `directoryId` | `integer` | No | The ID of the OneLogin Directory the user will be assigned to |
| `trustedIdpId` | `integer` | No | The ID of the OneLogin Trusted IDP the user will be assigned to |
| `managerUserId` | `string` | No | The OneLogin User ID for the user's manager Options are loaded from the connected account. |
| `samaccountname` | `string` | No | The user's Active Directory username |
| `memberOf` | `string` | No | The user's directory membership |
| `userPrincipalName` | `string` | No | The principle name of the user |
| `distinguishedName` | `string` | No | The distinguished name of the user |
| `externalId` | `string` | No | The ID of the user in an external directory |
| `openidName` | `string` | No | The name configured for use in other applications that accept OpenID for sign-in |
| `invalidLoginAttempts` | `integer` | No | The number of sequential invalid login attempts the user has made |
| `preferredLocaleCode` | `string` | No | The 2-character language locale for the user, such as en for English or es for Spanish. |
| `customAttributes` | `object` | No | An object to contain any other custom attributes you have configured |
| `mappings` | `string` | No | Controls how mappings will be applied to the user on creation. |
| `validatePolicy` | `boolean` | No | Will passwords validate against the User Policy? |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "onelogin",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "onelogin-update-user",
  arguments: {
    userId: "User ID",
    username: "Username",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "onelogin-update-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    onelogin: { authProvisionId: "apn_xxxxxxx" },
    userId: "User ID",
    username: "Username",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "onelogin-update-user",
    "configured_props": {
      "onelogin": { "authProvisionId": "apn_xxxxxxx" },
      "userId": "User ID",
      "username": "Username"
    }
  }'
```

---

- App: https://pipedream.com/apps/onelogin.md · All apps: https://pipedream.com/apps
