# How to authenticate cypress in passwordless with magic link authentication

**URL:** <https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947>\
**Category:** Get Help\
**Tags:** emails, management-api\
**Created:** [October 8, 2024, 9:42am UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947 "2024-10-08T09:42:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohsin\_poc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mohsin_poc/32/59973_2.png) [@mohsin\_poc](https://community.auth0.com/u/mohsin_poc)\
**Post date:** [October 8, 2024, 9:42am UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/1 "2024-10-08T09:42:32Z")

</div>

I’m looking for ways on how to authenticate web app for cypress test. The application only has passwordless authentication enabled. Any help is appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 11, 2024, 6:30pm UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/3 "2024-10-11T18:30:21Z")

</div>

Hi @mohsin_poc,

Welcome to the Auth0 Community!

You could use the [Authorization Code Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow) to authenticate your web app with passwordless.

Let me know if you have any questions.

Cheers,  
Rueben

---

<div class="post-metadata">

**Author:** ![mohsin\_poc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mohsin_poc/32/59973_2.png) [@mohsin\_poc](https://community.auth0.com/u/mohsin_poc)\
**Post date:** [October 15, 2024, 2:08pm UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/5 "2024-10-15T14:08:06Z")

</div>

Thanks @rueben.tiow. Can you expand on how a Authorization code flow would help here if the client is SPA?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 18, 2024, 7:48pm UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/6 "2024-10-18T19:48:10Z")

</div>

Hi @mohsin_poc,

If the client is a SPA, then you must use the [Authorization Code Flow with PKCE](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce/call-your-api-using-the-authorization-code-flow-with-pkce).

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![mohsin\_poc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mohsin_poc/32/59973_2.png) [@mohsin\_poc](https://community.auth0.com/u/mohsin_poc)\
**Post date:** [October 26, 2024, 1:18pm UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/7 "2024-10-26T13:18:55Z")

</div>

@rueben.tiow just making sure i understand the solution. I setup a dummy app in auth0 with passwordless with email code.  
When i hit the `/authorize` endpoint document in Authorization code flow. I’m presented with login screen. Entering the email would send a code to the email box. Now this is a problem, cypress does not have access to email box. what is the work around?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [November 5, 2024, 11:39pm UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/8 "2024-11-05T23:39:10Z")

</div>

Hi @mohsin_poc,

Thanks for the update.

> [@mohsin\_poc](#):
>
> Now this is a problem, cypress does not have access to email box. what is the work around?

You might be able to work around this by [configuring a Test SMTP Email Server](https://auth0.com/docs/customize/email/configure-test-smtp-email-servers) to capture and retrieve test emails from the passwordless login.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 19, 2024, 11:39pm UTC](https://community.auth0.com/t/how-to-authenticate-cypress-in-passwordless-with-magic-link-authentication/148947/9 "2024-11-19T23:39:56Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
