Category : api-authorization

I have a problem with authorization using the Bearer code. getClients(page: number, size: any, session_id: any): Observable<any> { let header = new HttpHeaders() .append(‘Access-Control-Allow-Origin’, ‘*’) .append(‘Content-Type’, ‘application/json’) .append(‘Accept’, ‘application/json’) .append(‘Authorization’, `Bearer ${localStorage.getItem(‘session_id’)}`); return this.http.get(`${this.apiUrl}get_clients?page[number]=${page}&page[size]=${size}`, { responseType: ‘json’, headers: header, }); } Qt code corsy what are p->socket->setHeader(QString("Allow").toLocal8Bit(),QString("GET, POST, OPTIONS").toLocal8Bit()); p->socket->setHeader(QString("Access-Control-Allow-Origin").toLocal8Bit(),QString("*").toLocal8Bit()); p->socket->setHeader(QString("Access-Control-Allow-Methods").toLocal8Bit(),QString("GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS").toLocal8Bit()); p->socket->setHeader(QString("Access-Control-Allow-Headers").toLocal8Bit(),QString("Content-Type, Origin, Accept, Authorization, ..

Read more

I have an API, which I need to consume to create reports, However that API requires username and password to access it, by using curl command I can access the API curl -X GET "https://SomeApiCall/api/v1/customers/" -H "accept:application/json; charset=UTF-8" -u "username:password" but when I am trying to use same API using angular I am getting below ..

Read more