I have some endpoints in REST API that use Auth::id() as optional field. I mean action may be called both by guest and logged in user. Now, if I put route outside auth:api middleware it works but Auth::id() is returning null even if bearer header was sent. When I move routing to auth:api it works as intended for logged in user but obviously is not accessible for guests.
As a workaround I can create 2 similar endpoints (one for guests, one for logged users) but duplicating endpoints looks wrong :/