> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# my.getOpenUserInfo

> Get basic user information with user consent.

Request access to the user's basic profile information. This API must be triggered by a button tap — it cannot be called directly on page load.

<Warning>
  This API requires the user to tap a `<button>` component with `open-type="getAuthorize"` and `scope="userInfo"`. Calling it outside of that interaction will fail. To obtain the `userId` specifically, use `my.getAuthCode` instead.
</Warning>

## Parameters

| Property | Type     | Required | Description                   |
| -------- | -------- | -------- | ----------------------------- |
| success  | Function | No       | Callback with user info       |
| fail     | Function | No       | Callback on failure           |
| complete | Function | No       | Callback that always executes |

## Success Callback

All fields return an empty string if the value is unavailable.

| Property    | Type   | Description                                 |
| ----------- | ------ | ------------------------------------------- |
| code        | String | Result code                                 |
| msg         | String | Result message                              |
| avatar      | String | Profile image URL (max 2048 bytes)          |
| nickName    | String | Display name (max 128 bytes)                |
| gender      | String | `m` for male, `f` for female                |
| countryCode | String | ISO 3166-1 alpha-2 country code (e.g. `IT`) |
| province    | String | User's province                             |
| city        | String | User's city                                 |

## Result Codes

| Code    | Meaning                  |
| ------- | ------------------------ |
| `10000` | Success                  |
| `40006` | Insufficient permissions |

## Code Example

```javascript theme={null}
// In your AXML template:
// <button open-type="getAuthorize" scope="userInfo" onGetAuthorize="onGetAuthorize">Get User Info</button>

onGetAuthorize(res) {
  my.getOpenUserInfo({
    success: (res) => {
      const userInfo = JSON.parse(res.response).response;
      console.log('Nickname:', userInfo.nickName);
      console.log('Avatar:', userInfo.avatar);
    },
    fail: (err) => {
      console.error('Failed to get user info:', err);
    }
  });
}
```
