I am working with fedcm api for authentication. I am using this
if ('IdentityCredential' in window) {
// AJAX call to login
navigator.login.setStatus('logged-in');
// TODO handle user canceling
const credential = await navigator.credentials.get({
identity: {
// Specify the IdP (or multiple IdPs, supported from Chrome 136) this Relying Party supports
providers: [
{
configURL: 'https://accounts.google.com/gsi/fedcm.json',
clientId: '<my-client-id>',
nonce: crypto.randomUUID()
}
]
}
});
console.log(credential);
}
and the client id has 2 URL's in the authorized JS domains. One is a public https server i am running. When I test this there, it works ok and I get the credential. But when I run this on localhost:3000, and I have http://localhost:3000 in the authorized JS domain, i still get
The fetch of the id assertion endpoint resulted in a network error: ERR_FAILED
localhost/:1 Server did not send the correct CORS headers.
main.js:26 Uncaught (in promise) IdentityCredential
Error: Error retrieving a token.
how do I get this to work?
http://localhostandhttp://localhost:3000, and that your referrer policy is set correctly - stackoverflow.com/a/78494068/1427878