# useAddOauthProvider | @account-kit/react

> Overview of the useAddOauthProvider hook from @account-kit/react

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function useAddOauthProvider(mutationArgs?): UseAddOauthProviderResult;
```

Defined in: [account-kit/react/src/hooks/useAddOauthProvider.ts:61](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/useAddOauthProvider.ts#L61)

A custom hook to handle adding an OAuth provider to an already authenticated account, which includes executing a mutation with optional parameters.

## Example

```ts twoslash
import { useAddOauthProvider } from "@account-kit/react";

const { addOauthProvider, isAddingOauthProvider, error } = useAddOauthProvider({
  // these are optional
  onSuccess: () => {
    // do something on success
  },
  onError: (error) => console.error(error),
});
```

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `mutationArgs?`
      </td>

      <td>
        `Partial`\<`Omit`\<`UseMutationOptions`\<`OauthProviderInfo`, `Error`, `Omit`\<`object` & OauthProviderConfig & OauthRedirectConfig, `"type"`>, `unknown`>, `"mutationFn"` | `"mutationKey"`>>
      </td>

      <td>
        Optional arguments for the mutation used for adding an OAuth provider.
      </td>
    </tr>

  </tbody>
</table>

## Returns

[`UseAddOauthProviderResult`](../type-aliases/UseAddOauthProviderResult)

An object containing the `addOauthProvider` function, `addOauthProviderAsync` for async execution, a boolean `isAddingOauthProvider` to track the mutation status, and any error encountered.