# OAuth2 Help

**URL:** <https://community.homey.app/t/oauth2-help/135674>\
**Category:** Developers\
**Created:** [April 29, 2025, 8:37pm UTC](https://community.homey.app/t/oauth2-help/135674 "2025-04-29T20:37:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Michiels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kyle_michiels/32/120769_2.png) [@Kyle\_Michiels](https://community.homey.app/u/Kyle_Michiels)\
**Post date:** [April 29, 2025, 8:37pm UTC](https://community.homey.app/t/oauth2-help/135674/1 "2025-04-29T20:37:50Z")

</div>

Hello!

I’m trying to build a very simple app to understand exactly how the OAuth2 flow with homey works since I’m not experienced with it.

I keep running into the following issue when I try to run the app with homey app run:  
Warning: Trying to access `Homey.env.CLIENT_ID` but the environment variable has not been set!  
Warning: Trying to access `Homey.env.CLIENT_SECRET` but the environment variable has not been set!

I defined them in my app.json, is this not the correct way?  
Do I need to upload the app towards the cloud and set them there? And can that be reused for further debugging?

I’m breaking my brain over it, it didn’t think it would be this confusing but the documentation is also lacking the part of where to store the client secret/ID.

For more context I want to auto generate the token for google calendar API access, but couldnt get that to work so now I’m building a demo app that tries to fetch my github profile.

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![s\_dimaio](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/s_dimaio/32/78995_2.png) [@s\_dimaio](https://community.homey.app/u/s_dimaio)\
**Post date:** [April 29, 2025, 9:18pm UTC](https://community.homey.app/t/oauth2-help/135674/2 "2025-04-29T21:18:46Z")

</div>

if I remember correctly you need to use an .env file in the root of the project

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [May 1, 2025, 9:14am UTC](https://community.homey.app/t/oauth2-help/135674/3 "2025-05-01T09:14:15Z")

</div>

Start reading here

> **[OAuth2 | Homey Apps SDK](https://apps.developer.homey.app/cloud/oauth2)**
>
> Authorise Homey to use a Web API with OAuth2.

Use the Athom npm module to add a base layer for oAuth2 to your app.  
Set env variables in env.json file and set this as excluded for Github upload.

If you follow the link, you get an example and the SDK for this module.

> **[Home - Homey OAuth2](https://athombv.github.io/node-homey-oauth2app/)**
