Electron OAuth App is a cross-platform desktop application that demonstrates how to implement OAuth authentication using Google Sign-In. The app is built with Electron providing a seamless login/logout flow with OAuth 2.0. This is built as part of the project "AIOps and Predictive Analytics for Container Logs Monitoring". Project files can be found here once they're made open source. Check the project website for more information.
This application and the project it's a part of are currently in active development stage. Basic OAuth login and logout functionalities are implemented in the application, and more improvements and additional features are planned.
The primary purpose of this application is to serve as a reference implementation for developers looking to integrate OAuth authentication into their Electron applications. It showcases the use of Ionic components for a consistent UI and provides a clear example of handling OAuth flows in a desktop environment.
- Node.js (v12 or higher)
- npm (v6 or higher)
- Google OAuth credentials
- Microsoft OAuth credentials
- Clone the repository:
git clone https://github.com/APratham/electron-oauth-app.git cd electron-oauth-app
- Install dependencies:
npm install
- Run the application:
npm run start
- Create a new project on the Google Cloud Console.
- Create an OAuth consent screen by adding name, email ID and developer contact information. Do not add a logo because it will ask for app verification.
- No need to add any scopes to your application. You can add test users if needed.
- Google allows adding upto 100 test users before verification will be needed.
- Create a client ID for application type as desktop app and name it whatever you want.
- Obtain the client ID and client secret and add them to
secrets.example.js
file. Rename the file tosecrets.js
.
- Create a new project on Azure Portal.
- Go through the steps to create an App Registration for a Desktop app.
- Mention
myapp://auth
in the redirect URI. - Once the App Registration is created, you have to edit the Manifest. Microsoft doesn't have a way to allow Implicit grants through the UI, so we need to use the Manifest. Look for
auth2AllowIdTokenImplicitFlow
andoauth2AllowImplicitFlow
and make those valuestrue
. Now when you go to Authentication you can see that "Access tokens" and "ID tokens" are checked. - You have to go to API permissions and assign the following permissions through Microsoft Graph delegated permissions:
email
offline_access
openid
profile
User.Read
- Add the client ID, tenant ID, and the redirect URI to
secrets.example.js
file and then rename it tosecrets.js
Contributions to this repository are not allowed as it is part of a project that is in active development.
For questions or issues related to this branch, please contact the Project Team.
This application and the project are licensed under the GNU Affero General Public License v3. See the LICENSE file for more details.