Category : ionic-framework

Working on a small ionic framework application with laravel backend. Request from postman or browser works fine, but builds from Android’s getting 419 token mismatch error with same endpoints. Request Data from Android (error 419): Headers Accept application/json Accept-Encoding gzip, deflate Accept-Language en-AU,en-US;q=0.9,en;q=0.8 Authorization [Filtered] Content-Length 25 Content-Type application/json Host app.example.com Origin http://localhost Referer http://localhost/ ..

Read more

Working on a small ionic framework application with laravel backend. Request from postman or browser works fine, but builds from Android’s getting 419 token mismatch error with same endpoints. Request Data from Android (error 419): Headers Accept application/json Accept-Encoding gzip, deflate Accept-Language en-AU,en-US;q=0.9,en;q=0.8 Authorization [Filtered] Content-Length 25 Content-Type application/json Host app.example.com Origin http://localhost Referer http://localhost/ ..

Read more

I’m trying to upload a file to a php laravel server from an ionic react app. postData.append(‘image’, this.state.post_pic); if (this.state.usr_txt !== "") { postData.set(‘text’, this.state.usr_txt); } else { postData.set(‘type’, ‘image’); } the this.state.post_pic has the file object when appended file object The request is sent using axios as shown below: axios({ method: ‘post’, url: ‘/api/post’, ..

Read more

i have been having Cors errors since last week.Here is what i have done. I have created my Middleware. Placed it in AppHttpMiddleware folder. Here is the code of my middleware. return $next($request) ->header(‘Access-Control-Allow-Headers’,’Content-Type, x-requested-with,consumer-key,consumer-secret,consumer-nonce,consumer-device-id,consumer-ip,credentials’) ->header(‘Access-Control-Allow-Methods’, ‘GET, POST, PUT, DELETE, OPTIONS’) ->header(‘Access-Control-Allow-Origin’,’*’); My ionic headers are as follows: let headers = { ‘consumer-key’: this.consumerKey, ‘consumer-secret’: ..

Read more

my controller i am creating laravel api with mondodb database when i hit url on postman data save in database but when i use ionic 4 show error undefine $destinationPath how to resolve please help public function store(Request $request) { $post = $request->all(); $data = array(); $rules = ([ ‘files’ => ‘required’, ]); $Validator=Validator::make($post,$rules); if($Validator->fails()) ..

Read more

I’m trying to send some data to my Laravel backend from my Ionic/Cordova/Angular frontend import { HTTP } from ‘@ionic-native/http/ngx’; … constructor(private http: HTTP){ } public postMyData(){ return new Promise((resolve, reject) => { let data = { ‘name’: ‘My name’, ‘age’ : ’42’} let url = this.baseURL + ‘/api/profile’; let headers = { "Authorization": "Bearer ..

Read more

I made a login API and put it in CORS middleware to run it from elsewhere like – Route::group([‘middleware’ => [‘cors’]], function () { Route::post(‘login’, [AuthController::class, ‘login’]); }); The middleware ‘cors’ is written in $routeMiddleware in ‘kernel.php’ file like protected $routeMiddleware = [ //some other middlewares ‘cors’ => AppHttpMiddlewareCors::class, ]; And in the same file, ..

Read more

this is my code store function : page service public store( data : any ) { return this.httpService.makePost(‘auth/personalInfo’, data, true).pipe(map( res => { localStorage.setItem( ‘token’, res.headers.get(‘Authorization’) ); return res.json().personal_info; }, error => { console.log("error stornig") localStorage.setItem( ‘token’, error.headers.get(‘Authorization’) ); return error.json(); } )); } addinfo function page.ts addInfo() { console.log("Hey mony"); let data = { ..

Read more