Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Node.js Device Flow Quickstart

A minimal Node.js console example showing how to sign in users on devices with limited input using the OAuth 2.0 Device Authorization Flow with MonoCloud.

What this repo shows

  • Requesting the device and user codes from MonoCloud
  • Displaying the verification URL and user code
  • Polling the token endpoint until the user completes the sign-in
  • Receiving and displaying the tokens

Built with @monocloud/auth-core.

Prerequisites

Before you begin, you’ll need:

  • A MonoCloud account
  • A Device application configured for Node.js in the MonoCloud Dashboard
  • Node.js 20 or later

Configure the client

Open src/index.ts and replace the placeholders with values from your MonoCloud application:

const client = new MonoCloudOidcClient(
  "https://<your-domain>",
  "<your-client-id>"
);

Run locally

npm install
npm start

Open the verification URL printed in the terminal from a browser on any device, enter the code, and complete the sign-in. Once approved, the app prints the tokens and exits. If anything goes wrong, the app prints the error and exits.

What to copy from this repo

  • Starting the flow with deviceAuthorizationRequest
  • Displaying the verification URL and user code
  • Polling the token endpoint with deviceAuthorizationGrant, handling authorization_pending and slow_down
  • Receiving the tokens once the user approves

This repo is a reference, not a framework.

📘 Learn more

🤝 Contributing & Support

Issues & Feedback

  • Use GitHub Issues for bug reports and feature requests.
  • For tenant or account-specific help, contact MonoCloud Support through your dashboard.

Security

Do not report security issues publicly. Please follow the contact instructions at: https://www.monocloud.com/contact

📄 License

Licensed under the MIT License. See the included LICENSE file.

About

MonoCloud Node.js Device Flow Quickstart Repository

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages