DEV Community

Cover image for Laravel Sanctum API Broken Issues
Ripon Uddin
Ripon Uddin

Posted on

2

Laravel Sanctum API Broken Issues

** Hey, Lara devs **

Today I am going to share something with you guys.

Maybe someday it will help you to resolve.

I was working with Laravel Project with sanctum.
We were preparing to go live. And I cleaned the full DB and created a new database user and new database at Digital Ocean Droplet with Linux Ubuntu 20.04.

After completing the user & database creation. I imported My Local Fresh SQL to the server new database.

In the meantime somehow id primary key was removed and the data type turn into big-int also auto-increment credentials were removed.

For that, Records are created without default id increment. ID was 0 for every-rows.

So, whenever I was trying to log in through API. It's successfully generating API Tokens also saving inside personal_access_tokens with id 0. I was also able to parse tokens.

When, I was passing the token with Bearer to get my profile information. And, I was getting a wired response like 405 Method Not allowed exception.

I checked locally more than 10 times , everything is working. Also, I tried to down and up Laravel application at production mood.
Nothing worked at all.

After long period, Once I just dropped the id column and created a new id column with primary index & auto-increment.
It works perfectly now.

Server : Droplet, Digital-Ocean

OS : Ubuntu 20.04

Version : Laravel 7

HappyCoding

clhg52

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more