# How to get user access\_token in actions

**URL:** <https://forum.rasa.com/t/how-to-get-user-access-token-in-actions/29811>\
**Category:** Rasa Open Source\
**Created:** [June 5, 2020, 10:17am UTC](https://forum.rasa.com/t/how-to-get-user-access-token-in-actions/29811 "2020-06-05T10:17:09Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![saurabh-m523](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/saurabh-m523/32/7887_2.png) [@saurabh-m523](https://forum.rasa.com/u/saurabh-m523)\
**Post date:** [June 11, 2020, 4:44am UTC](https://forum.rasa.com/t/how-to-get-user-access-token-in-actions/29811/4 "2020-06-11T04:44:12Z")

</div>

Hi @yprashant!

Sorry for the late reply. 😅

You can [customize](http://forum.rasa.com/t/which-is-the-correct-way-to-customize-an-existing-channel/20872/2) the socketio channel. You can then catch the token and then pass it as metadata to rasa by [editing this line](https://github.com/RasaHQ/rasa/blob/2725bdaaeda7bb3571358736d6d03326daf1c2e4/rasa/core/channels/socketio.py#L214) like this:

```auto
message = UserMessage(
                data["message"], output_channel, sender_id, input_channel=self.name(), metadata = data["access_token"]
            )

```

This will be now added to the tracker and you can extract it from the tracker in your actions with something like this:

```auto
def get_access_token(tracker: Tracker):
	for event in reversed(tracker.events_after_latest_restart()):
		if event.get('event') == 'user' and 'metadata' in event:
                access_token = event.get('metadata')
                return access_token

```

Hope that helps. 🙂

---

_[View the full topic](https://forum.rasa.com/t/how-to-get-user-access-token-in-actions/29811)._
