# asUser in async event function

**URL:** <https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529>\
**Category:** Forge Modules and Product Triggers\
**Tags:** events, confluence-cloud\
**Created:** [August 9, 2022, 11:44am UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529 "2022-08-09T11:44:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximilian](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maximilian](https://community.developer.atlassian.com/u/maximilian)\
**Post date:** [August 9, 2022, 11:44am UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529/1 "2022-08-09T11:44:09Z")

</div>

Hi.

I’m using the [async events API](https://developer.atlassian.com/platform/forge/runtime-reference/async-events-api/). When I push an event to a queue, like so:

```javascript
await queue.push({ "hello": "world" });

```

can I somehow make the event inherit the current user context?

Inside the event, I want to use

```javascript
await api.asUser().requestConfluence(…)

```

but that always fails. `asApp` works just fine.

When I log the `context` parameter in the resolver, I see that there’s an account ID field, but it’s always `undefined`:

```javascript
{
    installContext: 'ari:cloud:confluence::site/102f9718-17d8-11ed-861d-0242ac120002',
    accountId: undefined,
    license: undefined,
    jobId: 'page#1b50a3d0-17d8-11ed-861d-0242ac120002'
}

```

Any help would be appreciated.

Best regards,  
Maximilian

---

<div class="post-metadata">

**Author:** ![SamPurchase](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/sampurchase/32/41210_2.png) [@SamPurchase](https://community.developer.atlassian.com/u/SamPurchase)\
**Post date:** [August 9, 2022, 11:19pm UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529/2 "2022-08-09T23:19:35Z")

</div>

Hi @maximilian,  
Sorry, that isn’t possible today. Only functions that are directly invoked by the user will contain the user context and therefor have the ability to utilise the asUser API function call. This means that webtriggers, scheduled triggers, product events and asynch events are restricted to asApp api calls only.  
My team has been exploring introducing this feature for product events, but not yet asynch events.  
I have raised [[FRGE-805] - Ecosystem Jira](https://ecosystem.atlassian.net/browse/FRGE-805) for this based on your above feedback. Feel free to add any additional comments/feedback to this ticket in what you would like to see here.  
Cheers,  
Sam.

---

<div class="post-metadata">

**Author:** ![maximilian](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maximilian](https://community.developer.atlassian.com/u/maximilian)\
**Post date:** [August 10, 2022, 6:45am UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529/3 "2022-08-10T06:45:00Z")

</div>

Hi @SamPurchase,

Thank you for the quick reply and for raising the Jira issue.

Best regards,  
Maximilian

---

<div class="post-metadata">

**Author:** ![Leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@Leon](https://community.developer.atlassian.com/u/Leon)\
**Post date:** [October 25, 2024, 8:15am UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529/4 "2024-10-25T08:15:09Z")

</div>

Hi, is there any update on this? It would be super great if we could call `asUser` through Forge Async event.

---

<div class="post-metadata">

**Author:** ![kapitonik](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/kapitonik/32/50348_2.png) [@kapitonik](https://community.developer.atlassian.com/u/kapitonik)\
**Post date:** [January 30, 2025, 12:41am UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529/5 "2025-01-30T00:41:51Z")

</div>

Same question, is there any news around? asApp currently doesn’t support withProvider method to perform external auth for GDrive, for example on Async API. So, I have a kinda blocker here.

It’s possible to create some strange workaround by changing entity status flags, notifying the front-end part, and adding logic to “resend direct action request” from FE, once the status is updated to “I need to make a call to external API”, but it feels like the kinda wrong way of interaction.

---

<div class="post-metadata">

**Author:** ![rcsr](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/rcsr/32/50184_2.png) [@rcsr](https://community.developer.atlassian.com/u/rcsr)\
**Post date:** [January 30, 2025, 1:23am UTC](https://community.developer.atlassian.com/t/asuser-in-async-event-function/60529/6 "2025-01-30T01:23:21Z")

</div>

You can watch and vote for this ticket: [[ROADMAP-48] - Backend User Impersonation](https://ecosystem.atlassian.net/jira/polaris/projects/ROADMAP/ideas/view/5062047?selectedIssue=ROADMAP-48&issueViewLayout=sidebar&issueViewSection=overview)
