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.
- 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.
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
Open src/index.ts and replace the placeholders with values from your MonoCloud application:
const client = new MonoCloudOidcClient(
"https://<your-domain>",
"<your-client-id>"
);npm install
npm startOpen 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.
- Starting the flow with
deviceAuthorizationRequest - Displaying the verification URL and user code
- Polling the token endpoint with
deviceAuthorizationGrant, handlingauthorization_pendingandslow_down - Receiving the tokens once the user approves
This repo is a reference, not a framework.
- API Reference: https://monocloud.github.io/auth-js
- Use GitHub Issues for bug reports and feature requests.
- For tenant or account-specific help, contact MonoCloud Support through your dashboard.
Do not report security issues publicly. Please follow the contact instructions at: https://www.monocloud.com/contact
Licensed under the MIT License. See the included LICENSE file.