# How to Use Google Sheets for Managing Allowed Email List in Auth0 Login?

**URL:** <https://community.auth0.com/t/how-to-use-google-sheets-for-managing-allowed-email-list-in-auth0-login/128428>\
**Category:** Get Help\
**Tags:** account-linking, user-management\
**Created:** [February 27, 2024, 1:39pm UTC](https://community.auth0.com/t/how-to-use-google-sheets-for-managing-allowed-email-list-in-auth0-login/128428 "2024-02-27T13:39:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshap](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jshap/32/49627_2.png) [@jshap](https://community.auth0.com/u/jshap)\
**Post date:** [February 27, 2024, 1:39pm UTC](https://community.auth0.com/t/how-to-use-google-sheets-for-managing-allowed-email-list-in-auth0-login/128428/1 "2024-02-27T13:39:32Z")

</div>

I’m using an Auth0 login flow in my application, where access is restricted based on a hardcoded list of email addresses. However, this list of emails is quickly becoming long and difficult to manage. Google Sheet would be easier to manage my list of email addresses, but I’m unsure how I could integrate it into the code I have below.

```auto

exports.onExecutePostLogin = async (event, api) => {
  // List of allowed email addresses
  const allowedEmails = [
    "email1@example.com",
    "email2@example.com",
    // More emails here
  ];

  // Check if the user's email is in the allowed list
  if (event.user && event.user.email && allowedEmails.includes(event.user.email)) {
    // Actions for authorized users
  } else {
    // Deny access for others
    api.access.deny(`Access to ${event.client.name} is not allowed.`);
  } 
};

```

How can I modify this script to read the list of allowed email addresses from a Google Sheet instead of having them hardcoded within this script. Or are there other alternatives I could use? My client side app uses the single page app SDK.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [February 29, 2024, 7:19pm UTC](https://community.auth0.com/t/how-to-use-google-sheets-for-managing-allowed-email-list-in-auth0-login/128428/2 "2024-02-29T19:19:56Z")

</div>

Hi @jshap

Welcome back to the Auth0 Community!

Thank you for posting your question; currently, there’s no plug-and-play option to integrate Auth0 Action with Google Sheet easily; this would include preparing the sheet itself, setting up a serverless proxy that would act as a bridge between your action and Google Sheet, and based on that the script itself you would need to find an email address in the list which also takes time. It is possible but can lead to an unpleasant user experience with a long loading time.

I encourage you to use the user metadata for that purpose or role. During signup, all users will have the selected method set to false, and you can send the API request to update the information, allowing the user to gain access to the application. To check if this is the first user login, you can use `event.stats.logins_count`

[https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow#deny-access-to-anyone-calling-an-api](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow#deny-access-to-anyone-calling-an-api)  
[https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow#deny-access-to-anyone-calling-an-api](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow#deny-access-to-anyone-calling-an-api)

I hope this will help!

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![jshap](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jshap/32/49627_2.png) [@jshap](https://community.auth0.com/u/jshap)\
**Post date:** [March 6, 2024, 4:29pm UTC](https://community.auth0.com/t/how-to-use-google-sheets-for-managing-allowed-email-list-in-auth0-login/128428/3 "2024-03-06T16:29:03Z")

</div>

I’m not sure that workflow will work in my case. We don’t want users signing up. Our app is only using Google as the login. When I go to make a user in the user management console, it requires a user name and password.

---

<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:** [March 20, 2024, 4:29pm UTC](https://community.auth0.com/t/how-to-use-google-sheets-for-managing-allowed-email-list-in-auth0-login/128428/4 "2024-03-20T16:29:13Z")

</div>

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