Comments (13)
When I tried to use $table->string('id', 255);
, when registering a device I had an error about an incorrect value being inserted into column 'id'. What I did was leave it as tinyblob, remove the $table->primary(['id', 'user_id']);
fragment, and add a raw statement after creating the table:
DB::statement('ALTER TABLE web_authn_credentials ADD PRIMARY KEY (id(255), user_id)');
Notice the added (255)
after id
.
Using MySQL 5.7.29
from larapass.
https://github.com/DarkGhostHunter/Larapass/releases/tag/v3.0.0
from larapass.
As this StackOverflow answer, is a problem on MySQL end.
The solution to the problem is to remove the TEXT or BLOB column from the index or unique constraint or set another field as primary key. If you can't do that, and wanting to place a limit on the TEXT or BLOB column, try to use VARCHAR type and place a limit of length on it. By default, VARCHAR is limited to a maximum of 255 characters and its limit must be specified implicitly within a bracket right after its declaration, i.e VARCHAR(200) will limit it to 200 characters long only.
from larapass.
If MySQL isn't supported, there should be mention about it in readme.
from larapass.
Better, I can detect the driver, and if it's MySQL, change the column type to varchar(255)
.
It will add it next version. In the meantime, you should do the same.
from larapass.
You can change it to bigincreasementInteger, and add index to user_id
from larapass.
You can change it to bigincreasementInteger, and add index to user_id
An user can have more than 1 credentials. Doing that breaks it.
What the client returns as credential_id
is essentially anything. Since it's encoded in BASE64, we can just use binary. Doing an "hey, since MySQL shits its pants on indexing binary keys, I will use a varchar(255)
instead" it's not bad but there is a problem when trying to query for a binary string into a text string.
Now, the idea behind a composite primary key is that queries use the credential id
and the user_id
to identify each row.
I have pushed a fix on dev-master
. I don't have access to an MySQL instance, so if anybody can test, I can push it to the next version.
from larapass.
I updated the 2020_04_02_000000_create_web_authn_tables.php file to your new update today and used the php artisan migrate
command. It gave this error.
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'id' used in key specification without a key length (SQL: alter table
web_authn_credentialsadd primary key
web_authn_credentials_id_user_id_primary(
id,
user_id))
and
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'id' used in key specification without a key length")
I'm not familiar with tinyblob to know what it needs.
from larapass.
- For indexes on
BLOB
andTEXT
columns, you must specify an index prefix length.
It's the index prefix length. How we do that with Laravel? The docs say to use the static call:
Schema::defaultStringLength(255):
I think 255 should suffice, based on the assumption that no authenticator would push a larger than 255 characters string.
Can someone test this? Again, I'm unable to test on MySQL, at least on the short term.
from larapass.
I was able to make it work using
$table->string('id', 255);
- For indexes on
BLOB
andTEXT
columns, you must specify an index prefix length.It's the index prefix length. How we do that with Laravel? The docs say to use the static call:
Schema::defaultStringLength(255):
I think 255 should suffice, based on the assumption that no authenticator would push a larger than 255 characters string.
Can someone test this? Again, I'm unable to test on MySQL, at least on the short term.
I tried setting the defaultStringLength to 255 but the same error persisted.
from larapass.
$table->string('id', 255);
it's work, @DarkGhostHunter i've tried your update in mysql but it got error, because of MySQL assumes 3 bytes per utf8 character. 255 characters is the maximum index size you can specify per column, because 256x3=768, which breaks the 767 byte limit., you should add length of column
from larapass.
Okay, I've put an alpha for v3.0.
Check it out for any problems. I'll make a full project with it to test it thoroughly.
from larapass.
Fixed, id column now is string
VARCHAR
. Breaking change. But works on any database.
from larapass.
Related Issues (20)
- Cross origin fetch fails HOT 1
- Problems with MongoDB HOT 1
- JS helper: Mobile Safari invalid character '#' in function name HOT 3
- Laravel 8 HOT 1
- Finger print scanner does not appear. How to fix? HOT 5
- Larapass and yobikey that supported? HOT 2
- LARAVEL 8 Support HOT 9
- Argument 1 passed to Webauthn\PublicKeyCredentialRpEntity::__construct() must be of the type string, null given HOT 2
- Webauthn working on Chrome(Desktop) but not on android HOT 5
- Login fails with eiter typeless or email HOT 3
- BUG: Invalid JSON text inserting credentials HOT 4
- BUG: Invalid byte sequence for encoding "UTF-8" HOT 4
- Check if user has a device registered before showing a button HOT 1
- Configuration 'cache' => env('WEBAUTHN_CACHE'), HOT 3
- Confirm middleware and login issue HOT 1
- [SUGGESTION] Hacktoberfest ?
- Yubikey: User handle is mandatory HOT 4
- Possible values for WEBAUTHN_CACHE? HOT 1
- Laravel 9 Support HOT 1
- [4.x] Next version, big rewrite. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from larapass.