auth
Permet d'authentifier les utilisateurs.
Description
Cette méthode effectue l'autorisation des utilisateurs. Elle renvoie une Promise qui se résout en un objet IAuthEntity.
AuthProvider.auth(
marker*,
body*
);
Schéma des paramètres
Schéma
marker(obligatoire): string
L'identifiant textuel du fournisseur d'autorisation
exemple: "email"
body(obligatoire): IAuthPostBody
Les objets contiennent des informations d'authentification
exemple:
{
"authData": [
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value": "12345"
}
]
}
body.authData any[]
Données d'autorisation prises du formulaire attaché au fournisseur d'autorisation
exemple: ""
[
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value": "12345"
}
]
body.authData[index].marker string
Attribut de connexion du formulaire d'inscription
exemple: "example@oneentry.cloud"
body.authData[index].value string
Valeur de l'attribut de connexion du formulaire d'inscription
exemple: "12345"
Exemples
Exemple minimal
const body = { "authData": [ { "marker": "login", "value": "example@oneentry.cloud" }, { "marker": "password", "value":"12345" } ]};
const response = await AuthProvider.auth('email', body);
Exemple de réponse
{
"userIdentifier": "test@test.ru",
"authProviderIdentifier": "email",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwiYXV0aFByb3ZpZGVySWRlbnRpZmllciI6ImVtYWlsIiwidXNlcklkZW50aWZpZXIiOiJ0ZXN0QHRlc3QucnUiLCJpYXQiOjE3NjI0MjEyNzYsImV4cCI6MTc2MjQ1NzI3Nn0.TR3Hjud_cUWR_fHyy6e_f6qs7j42-yz0cgxvLZ0ZNBI",
"refreshToken": "1762421276286-93950574-bd0b-4a50-9cf5-8e5107d27b38"
}
Schéma de réponse
Schéma: IAuthEntity
userIdentifier: string
L'identifiant unique de l'utilisateur.
exemple: "user12345"
authProviderIdentifier: string
L'identifiant du fournisseur d'authentification.
exemple: "email"
accessToken: string
Le jeton d'accès pour la session utilisateur.
exemple: "abcdef123456"
refreshToken: string
Le jeton de rafraîchissement pour renouveler le jeton d'accès.
exemple: "ghijkl789012"