https://github.com/authgear/authgear-example-spa-js
Authgear sample for SPA (Single Page App)
https://github.com/authgear/authgear-example-spa-js
authentication authgear css html javascript sdk spa
Last synced: 4 months ago
JSON representation
Authgear sample for SPA (Single Page App)
- Host: GitHub
- URL: https://github.com/authgear/authgear-example-spa-js
- Owner: authgear
- Created: 2023-08-01T10:29:33.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T04:27:28.000Z (about 1 year ago)
- Last Synced: 2025-06-04T19:32:10.967Z (about 1 year ago)
- Topics: authentication, authgear, css, html, javascript, sdk, spa
- Language: JavaScript
- Homepage: https://www.authgear.com/post/add-authentication-to-any-web-page-in-10-minutes
- Size: 24.4 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Authgear sample for SPA (Single Page App)
This repo demonstrates how to add authentication into any JavaScript apps using Authgear.
## Project setup
1. Run `npm install` to install project dependencies.
2. Next, run `npm run dev` to start the application using `nodemon`, monitoring for changes as we modify files.
### Create Free Authgear Account
1. Goto [https://portal.authgear.com](https://portal.authgear.com) and create a free account (or login to your existing account).
2. Then navigate to Applications and create a new client application of type Single Page Application.
### Configuration
The project needs to be configured with your Authgear app's Endpoint and client ID in order for the authentication flow to work.
To do this, in `public/app.js`, replace these values with with your own Authgear application credentials:
```javascript
const AUTHGEAR_CLIENT_ID = "";
const AUTHGEAR_ENDPOINT = "";
```
Ensure that you add `http://localhost:3000/` as an Authorized Redirect URI in your Authgear Client Application.
## What is Authgear?
[Authgear](https://www.authgear.com/) is a highly adaptable identity-as-a-service (IDaaS) platform for web and mobile applications.
Authgear makes user authentication easier and faster to implement by integrating it into various types of applications - from single-page web apps to mobile applications to API services.
### Key Features
- Zero trust authentication architecture with [OpenID Connect](https://openid.net/developers/how-connect-works/) (OIDC) standard.
- Easy-to-use interfaces for user registration and login, including email, phone, username as login ID, and password, OTP, magic links, etc for authentication.
- Support a wide range of identity providers, such as [Google](https://developers.google.com/identity), [Apple](https://support.apple.com/en-gb/guide/deployment/depa64848f3a/web), and [Azure Active Directory](https://azure.microsoft.com/en-gb/products/active-directory/) (AD).
- Support biometric login on mobile, Passkeys, and Multi-Factor Authentication (MFA) such as SMS/email-based verification and authenticator apps with TOTP.
## Documentation
View other Authgear Documentation at [https://docs.authgear.com/](https://docs.authgear.com/)