CSRF token mismatch in L5 swagger apis

Viewed 15

I am creating documentation for my laravel project but on Post request in swagger I am getting csrf mismatch.

/**
     * @OA\Post(
     *     path="/api/admin/login",
     *     tags={"auth"},
     *     summary="Logs user into system",
     *     @OA\Parameter(
     *         name="email",
     *         in="query",
     *         description="The user name for login",
     *         required=true,
     *         @OA\Schema(
     *             type="string"
     *         )
     *     ),
     *     @OA\Parameter(
     *         name="password",
     *         in="query",
     *         required=true,
     *         @OA\Schema(
     *             type="string",
     *         )
     *     ),
     *     @OA\Response(
     *         response=200,
     *         description="successful operation",
     *         @OA\Header(
     *             header="X-Rate-Limit",
     *             description="calls per hour allowed by the user",
     *             @OA\Schema(
     *                 type="integer",
     *                 format="int32"
     *             )
     *         ),
     *         @OA\Header(
     *             header="X-Expires-After",
     *             description="date in UTC when token expires",
     *             @OA\Schema(
     *                 type="string",
     *                 format="datetime"
     *             )
     *         ),
     *         @OA\JsonContent(
     *             type="string"
     *         )
     *     ),
     *     @OA\Response(
     *         response=400,
     *         description="Invalid username/password supplied"
     *     )
     * )
     */

I have tried to find a useful solution but unable to find the issue. When I try to post req in swagger link it give me error

"message": "CSRF token mismatch.", "exception": "Symfony\Component\HttpKernel\Exception\HttpException", "file": "/Users/apple/Applications/locum-app/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php", "line": 383,

0 Answers
Related