{"record":{"id":"a7775be1064422ea","repo":"crater-invoice-inc/crater","slug":"the-provided-credentials-are-incorrect","errorCode":null,"errorMessage":"The provided credentials are incorrect.","messagePattern":"The provided credentials are incorrect\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":422,"severity":"error","filePath":"app/Http/Controllers/V1/Admin/Mobile/AuthController.php","lineNumber":20,"sourceCode":"\nnamespace Crater\\Http\\Controllers\\V1\\Admin\\Mobile;\n\nuse Crater\\Http\\Controllers\\Controller;\nuse Crater\\Http\\Requests\\LoginRequest;\nuse Crater\\Models\\User;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Support\\Facades\\Auth;\nuse Illuminate\\Support\\Facades\\Hash;\nuse Illuminate\\Validation\\ValidationException;\n\nclass AuthController extends Controller\n{\n    public function login(LoginRequest $request)\n    {\n        $user = User::where('email', $request->username)->first();\n\n        if (! $user || ! Hash::check($request->password, $user->password)) {\n            throw ValidationException::withMessages([\n                'email' => ['The provided credentials are incorrect.'],\n            ]);\n        }\n\n        return response()->json([\n            'type' => 'Bearer',\n            'token' => $user->createToken($request->device_name)->plainTextToken,\n        ]);\n    }\n\n    public function logout(Request $request)\n    {\n        $request->user()->currentAccessToken()->delete();\n\n        return response()->json([\n            'success' => true,\n        ]);\n    }","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/crater-invoice-inc/crater/blob/05d5ce26fdd8d9466009163444e944259bc0cc2a/app/Http/Controllers/V1/Admin/Mobile/AuthController.php#L2-L38","documentation":"Mobile admin login throws a Laravel ValidationException (HTTP 422 with an 'email' field error) when no User matches the given username/email or the password hash check fails — a generic guard that deliberately hides whether the account or the password was wrong.","triggerScenarios":"Thrown at app/Http/Controllers/V1/Admin/Mobile/AuthController.php:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Return the 422 validation response to the mobile client and display 'incorrect email or password'","Verify the user exists and the account is enabled before troubleshooting the password","Confirm the password column uses bcrypt hashes compatible with Hash::check"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"05d5ce26fdd8d9466009163444e944259bc0cc2a","analyzedAt":"2026-09-13T09:14:24.260Z","contentChangedAt":"2026-09-13T09:14:24.260Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}