# User \`status\` field differs in \`config()\` response vs \`getMyUserContext()\` response

**URL:** <https://devforum.zoom.us/t/user-status-field-differs-in-config-response-vs-getmyusercontext-response/77747>\
**Category:** Zoom Apps\
**Created:** [October 21, 2022, 4:23pm UTC](https://devforum.zoom.us/t/user-status-field-differs-in-config-response-vs-getmyusercontext-response/77747 "2022-10-21T16:23:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![om7](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/om7/32/36428_2.png) [@om7](https://devforum.zoom.us/u/om7)\
**Post date:** [October 21, 2022, 4:23pm UTC](https://devforum.zoom.us/t/user-status-field-differs-in-config-response-vs-getmyusercontext-response/77747/1 "2022-10-21T16:23:12Z")

</div>

in the [Advanced React Sample App](https://github.com/zoom/zoomapps-advancedsample-react), you listen on `onMyUserContextChange`;

```auto
zoomSdk.addEventListener("onMyUserContextChange", (event) => {
    handleUserContextStatus(event.status);
}); 

```

(Taken from the code [in Authorization component in the repo here](https://github.com/zoom/zoomapps-advancedsample-react/blob/6282e4efbf77e3848a99be2fdfec98d81958b24b/frontend/src/components/Authorization.js))  
[See your docs on the onMyUserContextChangeEvent here](https://appssdk.zoom.us/types/ZoomSdk.OnMyUserContextChangeEvent.html)

However, when examining the Typescript types the `npm` package, there does not seem to be a `status` field on this `onMyUserContextChange` event;

```nohighlight
declare type OnMyUserContextChangeEvent = {
    /** Timestamp at which the user's context change */
    timestamp: number;
    /** Role of the user */
    role: 'coHost' | 'attendee' | 'host';
    /** Screen name of the user */
    screenName: string;
};

```

(Taken directly from `@zoom/appssdk` `npm` package)

Also in the same [Advanced React Sample App](https://github.com/zoom/zoomapps-advancedsample-react), you check whether a user is in Guest mode by looking at either the `config()` response, or at the response from `getUserContext()` (in this case, `userContextStatus` is set to be either of those response values)

```nohighlight
if (userContextStatus === "authorized") {
  setInGuestMode(false);
  fetchUser();
} else if (
  userContextStatus === "unauthenticated" ||
  userContextStatus === "authenticated"
) {
    setInGuestMode(true);
}

```

this `userContextStatus` is initialized to be the `auth.status` field of the `ConfigResponse`;

```nohighlight
declare type AuthObject = {
    status: 'authorized' | 'unauthorized';
    upgradable: boolean;
};

declare type ConfigResponse = {
    /** The context in which the Zoom App is launched: inMeeting, inWebinar, inMainClient, inPhone. */
    runningContext: RunningContext;
    /** Unsupported JS APIs and events. */
    unsupportedApis: Apis[];
    /** Version of the Zoom Client in which the app is running. */
    clientVersion: string;
    /**'webview2/xxxx', 'cef/xxx', 'applewebkit/xx' */
    browserVersion: string;
    /**'authorized' or 'unauthorized' */
    auth: AuthObject;
    /** only available in meetings. Provides the specifications of audio and video */
    media?: MediaObject;
    /** provides the browser userAgent*/
    userAgent: string;
    /**
     * @hidden
     * (Supported starting in client version 5.11.0)
     * the product that this app is being run on
     * */
    product?: 'desktop' | 'mobile' | 'personalZoomRoom' | 'web' | 'sharedZoomRoom';
};

```

The `auth.status` value in the `config()` response seems to be only `'authorized' | 'unauthorized'`, whereas when calling `getUserContext()`, the response includes a `status` field that takes `'unauthenticated' | 'authenticated' | 'authorized'`;

```auto
declare type GetUserContextResponse = {
    /**
     *
     * | status |	Description |
     * | ------- | -------- |
     * | unauthenticated | Not signed in with Zoom. |
     * | authenticated | Authenticated with Zoom, but did not add the app. |
     * | authorized | The user has added the app and granted the required scope permissions. |
     */
    status: 'unauthenticated' | 'authenticated' | 'authorized';
    /** The name of the Zoom user as it appears in the meeting */
    screenName: string;
    /** A temporary participant-identifier - changes each time users join meetings or navigate between breakout rooms */
    participantId: string;
    /** A meeting-specific participant-identifier - it persists as users navigate between breakout rooms or briefly loses connections */
    participantUUID: string;
    /** The role of the Zoom App user in the meeting. Values: 'host', 'coHost', 'attendee', 'panelist' (webinar only) */
    role: string;
};

```

Sorry for the long write-up, but I’ve been deep in trying to implement in-client OAuth and referencing the example app above.

Is there a mistake somewhere in the types? Should each of these `status` values be of the same type?

For the time being, we are following the convention of the sample app by calling `getMyUserContext()` once `config()` succeeds, in order to get the user’s `status` rather than using `auth.status` on the `config()` response.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [October 21, 2022, 7:23pm UTC](https://devforum.zoom.us/t/user-status-field-differs-in-config-response-vs-getmyusercontext-response/77747/3 "2022-10-21T19:23:40Z")

</div>

@om7 Thanks for bringing this up. I think it’s important for our typings to be consistent. I pinged our engineering team to see if this is something we plan on unifying going forward and will get back to you when I have confirmation on our plans.

I’m glad to hear that you have a workaround for now.

---

<div class="post-metadata">

**Author:** ![om7](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/om7/32/36428_2.png) [@om7](https://devforum.zoom.us/u/om7)\
**Post date:** [October 21, 2022, 9:37pm UTC](https://devforum.zoom.us/t/user-status-field-differs-in-config-response-vs-getmyusercontext-response/77747/4 "2022-10-21T21:37:00Z")

</div>

Thanks @MaxM. Appreciate the response!

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 3, 2022, 12:15am UTC](https://devforum.zoom.us/t/user-status-field-differs-in-config-response-vs-getmyusercontext-response/77747/5 "2022-11-03T00:15:22Z")

</div>

@om7 No problem! We’re working to make sure that going forward we are using consistent types especially when it comes to UserContext.

I’ll reach out when we update the SDK.
