# Assistance Requested: OAuth2 Authentication for Device Integration

**URL:** <https://community.homey.app/t/assistance-requested-oauth2-authentication-for-device-integration/107052>\
**Category:** Developers\
**Tags:** help, homey-pro\
**Created:** [March 25, 2024, 2:49pm UTC](https://community.homey.app/t/assistance-requested-oauth2-authentication-for-device-integration/107052 "2024-03-25T14:49:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ab14](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ab14/32/80977_2.png) [@ab14](https://community.homey.app/u/ab14)\
**Post date:** [March 25, 2024, 2:49pm UTC](https://community.homey.app/t/assistance-requested-oauth2-authentication-for-device-integration/107052/1 "2024-03-25T14:49:50Z")

</div>

Dear Homey Community Members,

I am currently developing a Homey app intended for device integration, which requires implementing OAuth2 authentication. The process, particularly around user login and token acquisition, has presented some challenges. My concerns primarily revolve around the user’s interaction with the OAuth2 flow, especially since the Homey app environment does not inherently support web browser capabilities.

The issue at hand is the acquisition of the authorization code needed for the OAuth2 token exchange. The Homey OAuth2 client documentation outlines a method onGetTokenByCode(Code), which necessitates an authorization code. The mechanism for obtaining this code within a non-web browser environment is unclear to me. Specifically, how can we enable a user to authenticate their account and grant access to the app, thus securing the authorization code?

I am seeking advice on the following points:  
-Approaches for guiding users to an OAuth2 login page from within the Homey app.  
-Methods for capturing the authorization code post-authentication.

I am reaching out for insights, shared experiences, or any resources that could assist in overcoming these hurdles.

Thank you in advance for your assistance and for sharing your knowledge.

Best regards,  
Aayush

---

<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:** [March 25, 2024, 7:56pm UTC](https://community.homey.app/t/assistance-requested-oauth2-authentication-for-device-integration/107052/2 "2024-03-25T19:56:23Z")

</div>

Check the manuals:

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

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

Install the npm package and follow the example… and with only defining the clientId/secet and auth URL you can get all to work without any coding 🙂
