@alfenas wrote:
I’m new to ionic development, I need to log in to an api, where I need to pass the login header and password in the base64 format, and also need to send the device device data, I’m not getting success, I’ve researched google, but nothing helped me
Can someone help me please?private dispositivo = { "device_id" : "cleiton_device", "device_os_version" : "5.0", "device_model" : "ASUS_T00J", "device_name" : "ZENFONE", "device_manufacturer" : "ASUS INC", "device_api_version" : "19", "device_width": "800", "device_height": "600", "push_key":"token_retornado_pelo_firebase_tanto_no_android_quanto_ios" }; constructor( public http: Http ) { } efetuarLogin(matricula:string, senha:string) { return new Promise((resolve, reject) => { let headers = new Headers(); //headers.append("Authorization", "Basic" + btoa(matricula + ":" + senha)); headers.append("Authorization", "Basic MjAyODkzMTUxOjAxMDEyMDAx"); headers.append('Content-Type', 'application/json'); console.log(headers); this.http.post(this.URL_API + '/login/loginapp', this.dispositivo, {headers: headers}) .subscribe(res => { resolve(res.json()); console.log(res) }, (err) => { reject(err); console.log(err); }); }); }
Posts: 1
Participants: 1