You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A production-ready Chrome extension sample demonstrating secure device authentication using [Descope](https://www.descope.com/). This extension showcases how to integrate Descope's authentication platform within a browser extension context using modern Chrome Extension Manifest V3 standards.
A Chrome extension sample app demonstrating secure OAuth 2.0 authorization code flow using [Descope Federated Apps](https://www.descope.com/). This extension showcases how to integrate Descope's authentication platform within a browser extension context using modern Chrome Extension Manifest V3 standards.
- Navigate to Federated Apps in your Descope console
53
+
-Use the OIDC default application or create a new OIDC Federated App
54
+
-Note your **App ID** (optional - defaults to OIDC default application)
69
55
70
56
### 2. Extension Configuration
71
57
72
-
The extension requires your Descope project details:
73
-
74
-
-**Project ID**: Your Descope project identifier
75
-
-**Issuer Domain**: Your Descope project domain (e.g., `https://auth.company.com`)
76
-
77
-
These can be configured through the extension popup interface after installation.
58
+
Enter your **Project ID** and optionally your **App ID** in the extension popup after installation. If no App ID is provided, the extension will use the default Descope OIDC app.
78
59
79
60
## Development
80
61
@@ -83,108 +64,41 @@ These can be configured through the extension popup interface after installation
83
64
For active development with hot reload:
84
65
85
66
```bash
86
-
npm run watch
67
+
npm run watch# Build and watch for changes
87
68
```
88
69
89
-
This command:
90
-
- Uses Rollup to bundle JavaScript and CSS
91
-
- Outputs files to the `dist/` directory
92
-
- Watches for file changes and rebuilds automatically
93
-
- Enables live development workflow
94
-
95
-
### Loading the Extension in Chrome
70
+
### Loading in Chrome
96
71
97
-
1.**Open Chrome Extensions page:**
98
-
- Navigate to `chrome://extensions/`
99
-
- Or use Chrome menu → More tools → Extensions
100
-
101
-
2.**Enable Developer Mode:**
102
-
- Toggle the "Developer mode" switch in the top right corner
103
-
104
-
3.**Load the Extension:**
105
-
- Click "Load unpacked"
106
-
- Select the `dist/` directory from this project
107
-
- The extension icon will appear in your Chrome toolbar
108
-
109
-
4.**Reload After Changes:**
110
-
- Click the reload icon on your extension card in `chrome://extensions/`
111
-
- Or use the keyboard shortcut `Ctrl+R` (Windows/Linux) or `Cmd+R` (Mac)
112
-
113
-
### Development Tips
114
-
115
-
-**Debug Console**: Right-click the extension icon → Inspect popup
116
-
-**Background Script Debugging**: Go to `chrome://extensions/` → Click "Service worker" under your extension
117
-
-**Hot Reload**: Changes to source files automatically trigger rebuilds when using `npm run watch`
72
+
1. Go to `chrome://extensions/`
73
+
2. Enable "Developer mode"
74
+
3. Click "Load unpacked" and select the `dist/` directory
118
75
119
76
## Usage
120
77
121
-
### First Time Setup
78
+
### Setup
122
79
123
80
1.**Click the Extension Icon:**
124
81
- Look for the Descope icon in your Chrome toolbar
125
82
- Click to open the authentication popup
126
83
127
84
2.**Enter Project Details:**
128
-
-**Issuer Domain**: Enter your Descope project URL
129
-
-**Client ID**: Enter your Descope project ID
85
+
-**Project ID**: Enter your Descope project ID (required)
86
+
-**App ID**: Enter your Descope Federated App ID (optional - defaults to OIDC default application)
130
87
131
88
3.**Initiate Authentication:**
132
89
- Click the "Login" button
133
-
- The device authentication flow will begin
90
+
- The OAuth authorization code flow will begin
134
91
135
92
### Authentication Flow
136
93
137
-
1.**Device Code Generation:**
138
-
- Extension generates a unique device code
139
-
- QR code or verification URL is displayed
140
-
141
-
2.**Complete Authentication:**
142
-
- Follow the displayed instructions
143
-
- Verify your identity on the Descope verification page
144
-
- Return to the extension popup
145
-
146
-
3.**Success State:**
147
-
- User information will be displayed
148
-
- Authentication tokens are securely stored
149
-
- Extension is ready for use
150
-
94
+
1.**Authorization Request**: Extension generates a code verifier/challenge and redirects to Descope
95
+
2.**User Authentication**: User authenticates through the Descope flow
96
+
3.**Code Exchange**: Extension exchanges authorization code for tokens using PKCE
97
+
4.**Token Storage**: Access and ID tokens are securely stored and are able to be used by the extension
151
98
152
99
## Scripts
153
100
154
101
| Command | Description |
155
102
|---------|-------------|
156
-
|`npm run build`| Build the extension for production |
157
-
|`npm run watch`| Build and watch for changes during development |
158
-
|`npm test`| Run tests (currently not implemented) |
159
-
160
-
### Production Build
161
-
162
-
For creating a production-ready build:
163
-
164
-
```bash
165
-
npm run build
166
-
```
167
-
168
-
This creates optimized files in the `dist/` directory ready for Chrome Web Store submission.
169
-
170
-
### Getting Help
171
-
172
-
If you encounter issues:
173
-
174
-
1. Check the [Issues](https://github.com/descope-sample-apps/chrome-extension/issues) page
0 commit comments