I'm trying to set up a WebAuthn authentication flow on my website, but I'm bumping into an issue. I want my users to be able to register their devices on the main website (www.domain.com) so it's easily accessible through their user settings. Authentication itself happens on a different subdomain through an IdP (sso.domain.com). This is where trouble began.
There's a couple of things I've tried:
If I understand the spec correctly, passing 'scoutswechel.be' should actually work as both domains are subdomains of the main domain (correct me if I'm wrong here).
I prepare my challenges with PHP and pass them to the page with ajax calls. My PHP scripts returns for example following value:
{
"publicKey":{
"challenge":[105,107,101,103,105,49,119,115,98,108,119,109,48,109,105,53],
"user":{
"name":"walter",
"displayName":"Wouter Henderickx",
"id":[49,48,51]
},
"rp":{
"id":"scoutswechel.be",
"name":"scoutswechel.be"
},
"pubKeyCredParams":[
{
"alg":-7,
"type":"public-key"
}
],
"authenticatorSelection":{
"authenticatorAttachment":"cross-platform",
"requireResidentKey":false,
"userVerification":"preferred"
},
"attestation":null,
"timeout":60000,
"excludeCredentials":[],
"extensions":{
"exts":true
}
},
"b64challenge":"aWtlZ2kxd3NibHdtMG1pNQ"
}
I then convert the challenge and user.id to Uint8Array and pass the publickey part to:
navigator.credentials.create({publicKey: key.publicKey}).
then(function (aNewCredentialInfo) {
do.stuff()
})
How should I go about this? What values can I pass to the rp.id to get this working across both subdomains?
In the end, I figured it out. These were all implementation issues on my end:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With