Laragear / WebAuthn

Authenticate users with Passkeys: fingerprints, patterns and biometric data.
MIT License
295 stars 37 forks source link

[1.2] Incompatibility with User ID that uses ULID. #58

Closed akubima closed 11 months ago

akubima commented 11 months ago

PHP & Platform

8.1.2 - Ubuntu 22.04 WSL

Database

MySQL 8.0.28

Laravel version

10.10

Have you done this?

Expectation

How to change the webauthn_credentials.authenticatable_id data type?

image image

I can change it manually after the migration is done but how can I change it in the migration file instead? Is it possible?

$table->morphs('authenticatable', 'webauthn_user_index');

Thanks.

Description

I use ULID as ID (primary key) in the users table and everytime I tried to attest it is failed because the authenticatable_id column in the webauthn_credentials table does not match with the data type of my users table's ID column, how can I change the authenticatable_id to match the users.id data type which is CHAR(26)?

Thanks.

Reproduction

.

Stack trace & logs

No response

DarkGhostHunter commented 11 months ago

I can change it manually after the migration is done but how can I change it in the migration file instead? Is it possible?

Yes. use uuidMorphs instead.

akubima commented 11 months ago

Thanks it works :)