-
Notifications
You must be signed in to change notification settings - Fork 17.1k
NotSupportedError: The user agent does not support public key credentials. #48406
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
38.1.2
What operating system(s) are you using?
macOS
Operating System Version
MacOS 26.0 (25A354)
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
No response
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
- Should show the credentials manager that allows to save password
- Should show the auth modal that allows to share stored credentials
This works in Chromium Version 142.0.7440.0 (Developer Build) (arm64)
Actual Behavior
The credentials manager not working.
NotSupportedError: The user agent does not support public key credentials.
Testcase Gist URL
No response
Additional Information
minimum code to reproduce:
file name main.ts:
import { app, BrowserWindow } from 'electron/main';
async function storeCredentials() {
const creds = new PasswordCredential({
id: 'MyUserName',
name: 'MyName',
password: 'MyPassword',
iconURL: 'https://avatars.githubusercontent.com/u/4864089?v=4&size=256'
});
await navigator.credentials.store(creds);
await navigator.credentials.get({ password: true, mediation: 'optional' });
}
app.whenReady().then(async () => {
const win = new BrowserWindow({});
win.webContents.session.protocol.handle('http', (request) => {
return new Response('OK');
});
await win.loadURL('http://localhost/');
win.webContents.openDevTools();
await win.webContents.executeJavaScript(`(${storeCredentials.toString()})()`);
});electron main.tsIf this functionality is disabled for some reason what is the alternative.
It is fully supported since Chrome 60 https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential
Not sure but maybe I can polyfill this functionality using https://www.electronjs.org/docs/latest/api/safe-storage
though this message says
Uncaught (in promise) NotSupportedError: Only exactly one of "password', "federated', and
'publickey' credential types are currently supported.
so I guess it should work
