Laravel Testing API Token Unauthenticated

Sometimes, I got this error message when I tested my API routes.

It meant we have to authenticate the route. So I used actingAs() function. But I still got this error. After few minutes researching around, I found out that we can add second argument of actingAs() function to determine which guard should be used.

It worked!