blob: e56091be03f70369dc9d22782464383c6e004b37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
---
title: Navigator.credentials
slug: Web/API/Navigator/credentials
tags:
- API
- Credential Management API
- CredentialsContainer
- Propriété
- Reference
translation_of: Web/API/Navigator/credentials
---
<p>{{securecontext_header}}{{APIRef("")}}</p>
<p>La propriété <strong><code>credentials</code></strong>, rattachée à l'interface {{domxref("Navigator")}}, renvoie l'interface {{domxref("CredentialsContainer")}} qui expose des méthodes pour demander des informations d'authentification. L'interface {{domxref("CredentialsContainer")}} notifie également l'agent utilisateur lorsqu'un évènement pertinent se produit (une connexion ou une déconnexion réussie par exemple). Cette propriété peut être utilisée pour détecter si la fonctionnalité est prise en charge ou non.</p>
<h2 id="Syntaxe">Syntaxe</h2>
<pre class="syntaxbox">var credentialsContainer = navigator.credentials</pre>
<h3 id="Valeur">Valeur</h3>
<p>L'interface {{domxref("CredentialsContainer")}}.</p>
<h2 id="Exemples">Exemples</h2>
<pre class="brush: js">if ('credentials' in navigator) {
navigator.credentials.get({password: true})
.then(function(creds) {
// Gérer les informations d'authentification
});
} else {
// Gérer la connexion comme avant
};
</pre>
<h2 id="Spécifications">Spécifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Spécification</th>
<th scope="col">État</th>
<th scope="col">Commentaires</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('Credential Management')}}</td>
<td>{{Spec2('Credential Management')}}</td>
<td>Définition initiale.</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
<div class="hidden">Le tableau de compatibilité de cette page a été généré à partir de données structurées. Si vous souhaitez contribuer à ces données, n'hésitez pas à consulter <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> et à nous envoyer une <em>pull request</em>.</div>
<p>{{Compat("api.Navigator.credentials")}}</p>
|