[英]Secured connection between app and server
I try these code to connect my ionic app to apiserver (get)我尝试使用这些代码将我的 ionic 应用程序连接到 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)}`);
}
}
my API has API key and get data in URL我的 API 有 API 密钥并在 URL 中获取数据
It looks like you're already using https which is encrypted.看起来您已经在使用加密的 https。 A man in the middle attack should be prevented by default since browsers verify the certificate chain automatically.
默认情况下应该防止中间人攻击,因为浏览器会自动验证证书链。
I recommend reading this guide about https.我建议阅读有关 https 的指南。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.