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-storeto 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...