# Pass the current user's auth token to an external API

**URL:** <https://forum.bubble.io/t/pass-the-current-users-auth-token-to-an-external-api/229503>\
**Category:** APIs\
**Created:** [October 23, 2022, 11:56am UTC](https://forum.bubble.io/t/pass-the-current-users-auth-token-to-an-external-api/229503 "2022-10-23T11:56:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon40583251](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anon40583251](https://forum.bubble.io/u/anon40583251)\
**Post date:** [October 23, 2022, 11:56am UTC](https://forum.bubble.io/t/pass-the-current-users-auth-token-to-an-external-api/229503/1 "2022-10-23T11:56:43Z")

</div>

Hi there. I need to call an external API that will then create new resources within Bubble. These resources have privacy settings that only allow them to be created **by an authenticated user**. The API doesn’t know who the user is, so I need to pass this from Bubble together with other request parameters.

Questions:

1. How do I get the current user’s auth token?
2. How do I call my API from a user’s action, passing the token and other dynamic data?

Thanks!

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [October 23, 2022, 10:58pm UTC](https://forum.bubble.io/t/pass-the-current-users-auth-token-to-an-external-api/229503/2 "2022-10-23T22:58:19Z")

</div>

This thread where I muse in real-time about this is somewhat out of date, but will probably inspire you a bit. (Consulting the updated docs about this would help you too.)

> [@How To Assign A User To A API Workflow Endpoint](http://forum.bubble.io/t/how-to-assign-a-user-to-a-api-workflow-endpoint/49468/2):
>
> Authentication: Session cookie. If the call is done from the browser and there is a session cookies present, the user represented by the cookie will be the call will be run in the context of this user. Obviously, there are some typos here, but you should get the idea? If I’m logged in to your app and I call your app’s workflow API, that workflow runs in my context. If I am not logged into your app, this API will fail as I am not authenticated – unless authentication is not required, in w…

I don’t have an example of this but you would build an authentication endpoint in your app (which could now be either a GET or POST) and that would return the authentication token and then that can be used by the next webhook. Alternatively if such a facility is not available, you could pass the users credentials to an endpoint that logs the user in, gets the auth token then does whatever you need the Data API to do and returns the right values.

Anyway, links to the docs are included in the thread. I can’t think of a more helpful explanation than this, even though it’s not an absolute answer.

Whether you can do this entirely programmatically depends on a lot of different factors.

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [October 23, 2022, 11:04pm UTC](https://forum.bubble.io/t/pass-the-current-users-auth-token-to-an-external-api/229503/3 "2022-10-23T23:04:15Z")

</div>

And, Obvs, if the user is present and logged into your app, this is much easier (this seems to be implied in your original question), and in that case you can do this entirely programmatically.
