Skip to content

[5.x]: 'Unable to load the data' error when creating a passkey #14745

@tommysvr

Description

@tommysvr

What happened?

Description

Unable to create a passkey due to an 'Unable to load the data' error. Underlying error seems to be 'Request must accept JSON in response'.

Steps to reproduce

  1. Your user account > Passkeys > Add a passkey
  2. Follow the steps to save, choosing any method (I got the same error with iCloud Keychain, Chrome and 1Password)

Expected behavior

Passkey is created successfully.

Actual behavior

Receive a generic 'Unable to load the data' with nothing in the logs. Looking at the error in the browser console, I see a 400 error:

yii\web\BadRequestHttpException: Request must accept JSON in response in /var/www/html/vendor/craftcms/cms/src/web/Controller.php:554
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/controllers/AuthController.php(214): craft\web\Controller->requireAcceptsJson()
#1 [internal function]: craft\controllers\AuthController->actionVerifyPasskeyCreation()
#2 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#4 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('verify-passkey-...', Array)
#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction('auth/verify-pas...', Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(650): craft\web\Application->runAction('auth/verify-pas...', Array)
#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(311): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#8 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#9 /var/www/html/web/index.php(12): yii\base\Application->run()
#10 {main}

Craft CMS version

5.0.0

PHP version

8.2

Operating system and version

No response

Database type and version

MySQL 8.0

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions