Secured connection between app and server

hi i try these code to connect my ionic app to apiserver (get)

    import { Injectable } from '@angular/core';
    import { HttpClient } from '@angular/common/http';
    import { Observable } from 'rxjs';
    import { map } from 'rxjs/operators';
     
    @Injectable({
      providedIn: 'root'
    })
    export class EncryptionService {
    
      url = 'https://api.am....com';
       api-key='......'

      constructor(private http: HttpClient) { }
     
        newcheck(checkid: string ,cost: string,toname: string,tocode: string,passcode: string,date: string,checkfor: string,back: string): {
        return this.http.get(`${this.url}?key=${this.api-key}&checkid=${encodeURI(checkid)}&cost=${encodeURI(cost)}&toname=${encodeURI(toname)}&tocode=${encodeURI(tocode)}&passcode=${encodeURI(passcode)}&date=${encodeURI(date)}&checkfor=${encodeURI(checkfor)}&back=${encodeURI(back)}`);
    }
    
   
    }

my API has API key and get data in URL

how can i perform these in the secured way?

for example to prevent someone to listen and monitor transferred data between app and server?
or prevent someone to distract and fake received data by app?

or anything to make this connection secured

That’s what SSL is for. So as long as you’re using https:// endpoints like suggested in your post, the underlying transport protocol mitigates against man-in-the-middle attacks such as that you describe.

1 Like