A minimal Node.js application demonstrating the OAuth 1.0a flow with the Clever Cloud API. Zero external dependencies.
- A Clever Cloud account
- Clever Tools CLI installed
- An OAuth consumer (see Create an OAuth consumer)
- Node.js 24+ for local development
Install Clever Tools and log in:
# Alternative install methods:
# https://www.clever.cloud/developers/doc/cli/install/
npm i -g clever-tools
clever loginClone this repository and create the application:
git clone https://github.com/CleverCloud/oauth1-example
cd oauth1-example
clever create --type node
# Must match the base URL configured in your OAuth consumer
# For production, use a custom domain instead of cleverapps.io
clever domain add <example-domain>.cleverapps.io
clever domain favourite set <example-domain>.cleverapps.io
clever env set OAUTH_CONSUMER_KEY "your_consumer_key"
clever env set OAUTH_CONSUMER_SECRET "your_consumer_secret"
clever env set APP_HOST "$(clever domain favourite)"
clever deploy
clever openCreate a .env file with your OAuth consumer credentials (base URL set to http://localhost:8080):
OAUTH_CONSUMER_KEY=your_consumer_key
OAUTH_CONSUMER_SECRET=your_consumer_secretnpm run devThe app listens on http://localhost:8080 by default. Set PORT to change it.
- User clicks "Login with Clever Cloud"
- Server obtains a request token and redirects to the Clever Cloud authorization page
- After approval, Clever Cloud redirects back with a verifier
- Server exchanges the verifier for an access token
- Tokens are stored in the browser's
localStorage - Client calls
/api/self, server proxies the request toGET /v2/selfwith OAuth1 signing
├── server.js # HTTP server and routing
├── oauth.js # OAuth1 HMAC-SHA512 signing and flow
└── public/
├── index.html # Page structure
├── style.css # Design system
├── app.js # Client-side logic and rendering
└── logo.svg # Clever Cloud logo
See the full OAuth1 documentation for details on the protocol.