Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Handling Sanctum Session Tokens

Premium
5 min read

Our users can finally log in, and we are saving their API token. So, let's start using it to make our API calls:

  • Restore the Laravel code changes to the original state.
  • Implement expo-secure-store to store the token in the device's secure storage.
  • Write Axios interceptors to add the token to the headers of all requests.

Reverting Laravel Code Changes

Let's start this by reverting all of our Laravel code changes to the original state:

app/Http/Controllers/Api/CategoryController.php

public function store(StoreCategoryRequest $request)
{
$category = Category::create($request->validated());
$category = auth()->user()->categories()->create($request->validated());
 
return new CategoryResource($category);
}

And then...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…