You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Facebook sometimes provides a token longer than 255 characters, which causes an error when inserting into the "token" field.
To Reproduce
Steps to reproduce the behavior:
1.Navigate to 'Facebook login'.
2.Click 'Login'.
3.A database error occurs for the token field in the [social_provider_user] table.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
System Details
OS: Ubuntu
Browser chrome
Auth Version 1.0.2
Additional context
Consider updating the database schema to assign a specific length to the token field (512 characters should be sufficient).
public function up(): void
{
Schema::create('social_provider_user', function (Blueprint $table) {
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->string('provider_slug'); // maps to providers slug in the devdojo.auth.providers
$table->string('provider_user_id');
$table->string('nickname')->nullable();
$table->string('name')->nullable();
$table->string('email')->nullable();
$table->string('avatar')->nullable();
$table->text('provider_data')->nullable(); // JSON data containing additional provider data we want to include
// Specify lenth in token field default 255 can't handle the real data
- $table->string('token');
+$table->string('token', 512);
$table->string('refresh_token')->nullable();
$table->timestamp('token_expires_at')->nullable();
$table->timestamps();
$table->primary(['user_id', 'provider_slug']);
});
}
/**
The text was updated successfully, but these errors were encountered:
@neosign, You have a valid point; sometimes the Facebook token length is longer. There is an interesting discussion about this on Stack Overflow here.
While we can't predict the exact token length, updating the database schema's token field length may not be necessary. Not all providers issue lengthy tokens, and there is no standard token length. The simplest solution would be to change the field length to your preference. What do you think about that?
Describe the bug
Facebook sometimes provides a token longer than 255 characters, which causes an error when inserting into the "token" field.
To Reproduce
Steps to reproduce the behavior:
1.Navigate to 'Facebook login'.
2.Click 'Login'.
3.A database error occurs for the token field in the [social_provider_user] table.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
System Details
Additional context
Consider updating the database schema to assign a specific length to the token field (512 characters should be sufficient).
The text was updated successfully, but these errors were encountered: