# Obtaining access token in dockerized E2E tests

**URL:** <https://community.auth0.com/t/obtaining-access-token-in-dockerized-e2e-tests/33175>\
**Category:** Get Help\
**Tags:** spa, jwt, testing\
**Created:** [November 1, 2019, 12:21am UTC](https://community.auth0.com/t/obtaining-access-token-in-dockerized-e2e-tests/33175 "2019-11-01T00:21:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew.ngo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andrew.ngo/32/12751_2.png) [@andrew.ngo](https://community.auth0.com/u/andrew.ngo)\
**Post date:** [November 1, 2019, 12:21am UTC](https://community.auth0.com/t/obtaining-access-token-in-dockerized-e2e-tests/33175/1 "2019-11-01T00:21:06Z")

</div>

I am developing a mock Auth0 server for when running my dockerized E2E tests as suggested by this article ([https://auth0.com/docs/support/testing](https://auth0.com/docs/support/testing)). The article doesn’t state how to obtain access tokens nor the responses when testing and was wondering how I would be able to?

My application uses the auth0 SPA SDK and I intend on having the requests be sent to my mock Auth0 server in E2E tests. I was planning to send the same response when actually logging in and provide a long lived access token. My only issue is that the longest token I can create is 30 days and unsure what the Auth0 SPA library expects for the rest of the response.

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [January 24, 2020, 9:29pm UTC](https://community.auth0.com/t/obtaining-access-token-in-dockerized-e2e-tests/33175/3 "2020-01-24T21:29:34Z")

</div>

Hi Andrew.  
Not sure how much your test suite will let you mock things, but auth0-spa-js is based on interactive flows: it expects a user to follow all the necessary interactive steps (which could be login, mfa and/or consent) before returning a token. Also, when the SDK makes a token request it generates a random state and nonce values that are expected to be returned in the authentication response, so you’ll need to take that into account as well.
