Skip to content

monocloud/web-js-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


JavaScript Quickstart

A minimal JavaScript SPA example showing how to add authentication with MonoCloud.

What this repo shows

  • MonoCloud authentication in a vanilla JavaScript SPA (no framework)
  • Authorization Code + PKCE sign-in and sign-out
  • Handling the sign-in and sign-out callbacks
  • Reading the signed-in user from the session

Built with @monocloud/auth-web-js.

Prerequisites

Before you begin, you’ll need:

Configure the client

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

const options: MonoCloudWebJSClientOptions = {
  tenantDomain: "https://<your-domain>",
  clientId: "<your-client-id>",
  appUrl: "http://localhost:5173",
  callbackPath: "/callback",
  signOutCallbackPath: "/signout",
};

Application URLs (local)

Configure these in your MonoCloud app:

  • Callback URL → http://localhost:5173/callback
  • Sign-out URL → http://localhost:5173/signout
  • Cross-Origin URL → http://localhost:5173

Run locally

npm install
npm run dev

Open http://localhost:5173

What to copy from this repo

  • Client initialization with MonoCloudWebJSClient
  • Sign-in and sign-out callback handling
  • Reading the authenticated user from the session
  • Sign-in and sign-out actions

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.

Releases

No releases published

Packages

 
 
 

Contributors