kea_rajab's avatar

Flutter with Laravel 8 as Backend

hi everyone! i have been struggling lately with implementing login in form on a laravel powered site using a flutter fontend for mobile applications... the error is 419 which later is explained as the "CSRF Token mismatch" and the following is the code that am using in the flutter application to send the post request to the login route...

onTap: () async {
                          String phone_number = phonenumberController.text;
                          String password = passwordController.text;
                          var data = {
                            'phone_number': phone_number,
                            'password': password
                          };
                          var res = await  http.post('https://tikety.co.tz/sw/login',
                                            headers: {
                                              'Content-type': 'application/json',
                                              'Accept': 'application/json; charset=UTF-8',
                                            },
                                            body: {
                                              "email": phone_number,
                                              "password" : password
                                            } ) ;
                          print(res.body);
}

so after tapping that button all i receive and what is shown on both the dart devTools and the laravel telescope is a 419 status code... Can anyone help me solve this and resolve the token mismatch issue...? Thanks in advance

0 likes
0 replies

Please or to participate in this conversation.