Description
I’ve been trying to get a signature from the zoom SDK which works perfectly on Localhost but throws an error when deployed on firebase.
Note: Post request is sent from Angular App and received on sample Zoom SDK on Nodejs hosted on firebase.
Browser Console Error
Access to XMLHttpRequest at ‘https://example.com/’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
This small Snippet is already there in the SDK for relax this Error but it does not work.
app.use(bodyParser.json(), cors())
app.options(‘*’, cors())
Also, I tried giving Allow Access Headers in the post request itself for debugging like this but this does not either.
headers = new HttpHeaders({‘Access-Control-Allow-Origin’: ‘*’})
getSignature(){
this.http.post<any>('https://example.web.app', { "meetingNumber": "9027261428", "role": 1 } ,{headers: this.headers}).subscribe(data => {
console.log(data.signature);
})
}
Meeting SDK Code Snippets
getSignature() {
this.httpClient.post(this.signatureEndpoint, {
meetingNumber: this.meetingNumber,
role: this.role
}).toPromise().then((data: any) => {
if(data.signature) {
console.log(data.signature)
this.startMeeting(data.signature)
} else {
console.log(data)
}
}).catch((error) => {
console.log(error)
})
}
Device (please complete the following information):
- Device: Any Device
- OS: Windows
- Browser: Tested on Chrome and Edge
Thanks in Advance.