# How to test using passport-auth0 strategy

**URL:** <https://community.auth0.com/t/how-to-test-using-passport-auth0-strategy/54261>\
**Category:** Get Help\
**Tags:** unit-testing, login, auth0\
**Created:** [December 3, 2020, 12:51am UTC](https://community.auth0.com/t/how-to-test-using-passport-auth0-strategy/54261 "2020-12-03T00:51:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlai](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jlai/32/12805_2.png) [@jlai](https://community.auth0.com/u/jlai)\
**Post date:** [December 3, 2020, 12:51am UTC](https://community.auth0.com/t/how-to-test-using-passport-auth0-strategy/54261/1 "2020-12-03T00:51:08Z")

</div>

Hi, totally new to auth0 here. My team for a school project used passport-auth0 for its authentication: login, signup, and session cookies. The tutorial we followed is:

> **[How to Create Secure React & Express Apps](https://javascript.plainenglish.io/secure-react-express-apps-jsonwebtoken-cookie-session-auth0-and-passport-tutorial-e58d6dce6c91?gi=edd296e3dac7)**
>
> With jsonwebtoken, cookie-session, auth0, and passport

and sort of by extension:

> **[Node.js and Express Tutorial: Authentication Using Passport](https://auth0.com/blog/create-a-simple-and-secure-node-express-app/)**
>
> Learn how to use Passport.js to add user authentication to a web app built with Node.js and Express. Secure static sites built with Expre...

Now for the last part of our assignment, we have to perform unit testing, and are aiming for good test coverage. We’re using mocha and chai-http to write our backend tests, and would like to test the authentication routes (login, logout, current-session, callback), but I’ve found few resources that work for programmatically logging a user in through passport-auth0 strategy. Any help to do this would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 3, 2020, 12:12pm UTC](https://community.auth0.com/t/how-to-test-using-passport-auth0-strategy/54261/2 "2020-12-03T12:12:32Z")

</div>

Hey there!

Unfortunately we don’t have specific guidance for testing for this part of the stack only general content on performing tests:

- [Test Applications Locally](https://auth0.com/docs/dev-lifecycle/work-with-auth0-locally)
- [Get Management API Access Tokens for Testing](https://auth0.com/docs/tokens/management-api-access-tokens/get-management-api-access-tokens-for-testing)
- [Test Connections](https://auth0.com/docs/connections/how-to-test-partner-connection)
- [https://auth0.com/docs/best-practices/rules-testing-best-practices](https://auth0.com/docs/best-practices/rules-testing-best-practices)
