Single Sign-on (SSO) is an authentication scheme that allows a user to log in with a single ID to any one of several related but independent software systems. This means that the user will be able to log in to a third-party page on their intranet without having to enter their credentials again.
This connection is possible with BioAtlas Vet by integrating it to your institution's intranet.
The presented service is designed to carry out user authentication with the injection of cookies from the 200-OK return of the request.
To carry out and obtain the expected return, it is necessary to have the following information, if any:
Header | |
---|---|
x-api-key | Ex: x-api-key: IJIXAJ22O6CIFVBV1CMX |
Body (JSON) | |
---|---|
Username - (name: String) | Ex: “name”: ”José da Silva” |
CPF - (cpf: String) | Ex: “cpf”: “36556357820” |
Class (Courso) - (class: String) |
Ex: “class”: “Medicina” |
User email - (email: String) |
Ex: “email”: “email@exemplo.com” |
Group - (group: String) |
Ex: “group”: “teacher” Para professores enviar “group”: “teacher”, para alunos enviar "painel-user" |
You must always have a valid x-api-key and send a JSON containing at least your Email or CPF. If you do not have the x-api-key, please contact our support team via a Technical Support Request (https://medicalharbour.zendesk.com/hc/pt-br/requests/new).
As a security measure, it is highly recommended that the code be implemented in the back-end and that the response with the cookie (header) be redirected to the front-end.
Utilização:
1. Endpoint
https://api2.medicalharbour.com/auth/sso |
2. Headers
The request headers must have the following fields:
x-api-key: YOUR_API_KEY |
|
Content-Type: application/json |
3.Body
The body must contain the information of the user who intends to access BioAtlas Vet.
{
} |
“name”: “José da Silva”, “cpf”: “36556357820”, “class”: “Medicina Veterinária”, “email”: “email@exemplo.com” “group”: “teacher” |
4.Options
Use the following information in Request Options:
{
} |
credentials: “include”, method: ‘POST’, body: raw, redirect: ‘follow,’ |
5.Response
If the result is 200-OK, the following message should appear on the console:
{"status": "success", "msg": "https://bioatlas.medicalharbour.com/Home"}
Result:
When entering the link (https://bioatlasvet.medicalharbour.com/Home), the user must log in, as shown in the image:
{
} |
credentials: “include”, method: ‘POST’, body: raw, redirect: ‘follow,’ |
Code Sample:
Below is a complete example of the JavaScript script used for demonstration:
function main() { var myHeaders = new Headers(); myHeaders.append("x-api-key", "IJIXAJ22O6CIFVBV1CMX"); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ “name”: “José da Silva”, “cpf”: “36556357820”, “class”: “Medicina Veterinária”, “email”: “email@exemplo.com” “group”: “teacher” });
var requestOptions = { credentials: "include", method: 'POST', headers: myHeaders, body: raw, redirect: 'follow'};
fetch("https://api2.medicalharbour.com/auth/sso", requestOptions) |
.then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
} |
Nota: Em caso de dúvidas, entre em contato com nosso time de suporte técnico através de uma Solicitação de Suporte Ténico (https://medicalharbour.zendesk.com/hc/pt-br/requests/new).
Comments
0 comments
Please sign in to leave a comment.