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

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay