Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1081274 of CredentialsContainer.get()

  • Revision slug: Web/API/CredentialsContainer/get
  • Revision title: CredentialsContainer.get()
  • Revision id: 1081274
  • Created:
  • Creator: rolfedh
  • Is current revision? Yes
  • Comment Editorial review. No changes required.

Revision Content

{{APIRef("")}}{{SeeCompatTable}}

The get() method of the {{domxref("CredentialsContainer")}} interface returns a {{jsxref("Promise")}} to a {{domxref("Credential")}} instance that matches the provided parameters.

This method is restricted to top-level contexts. Calls to it within an <iframe> element will resolve without effect.

Syntax

CredentialsContainer.get([options]).then(function(Credential) { ... })

Parameters

options {{optional_inline}}
An object that sets options to look for among the credentials in the {{domxref("CredentialsContainer")}}. The available options are:
  • password: a {{jsxref("Boolean")}} indicating that returned {{domxref("Credential")}} instances should include user (as opposed to federated) credentials. 
  • federated: An object containing requirements for returned federated credentials. The available options are:
    • providers: An array of {{domxref("DOMString")}} instances of identity providers to search for.
    • protocols n array of {{domxref("DOMString")}} instances of federation protocols to search for.
  • unmediated: a {{jsxref("Boolean")}} indicating a returned {{domxref("Credential")}} instances should not require user mediation.

Returns

A {{jsxref("Promise")}} to a {{domxref("Credential")}} instance that matches the provided parameters.

Example

// TBD

Specifications

Specification Status Comment
{{SpecName('Credential Management')}} {{Spec2('Credential Management')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(51.0)}}        
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatChrome(51.0)}}           {{CompatChrome(51.0)}}

Revision Source

<p>{{APIRef("")}}{{SeeCompatTable}}</p>

<p>The <strong><code>get()</code></strong> method of the {{domxref("CredentialsContainer")}} interface returns&nbsp;a {{jsxref("Promise")}} to a {{domxref("Credential")}} instance that matches the provided parameters.</p>

<div class="note">
<p>This method is restricted to top-level contexts. Calls to it&nbsp;within an <code>&lt;iframe&gt;</code> element will resolve without effect.</p>
</div>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">
CredentialsContainer.get([options]).then(function(Credential) { ... })</pre>

<h3 id="Parameters">Parameters</h3>

<dl>
 <dt>options {{optional_inline}}</dt>
 <dd>An object that sets&nbsp;options to look for among the credentials in the {{domxref("CredentialsContainer")}}.&nbsp;The available options are:
 <ul>
  <li><code>password</code>: a {{jsxref("Boolean")}} indicating that returned {{domxref("Credential")}} instances should include user (as opposed to federated) credentials.&nbsp;</li>
  <li><code>federated</code>: An object containing requirements for returned federated credentials. The available options are:
   <ul>
    <li><code>providers</code>: An array of {{domxref("DOMString")}} instances of identity providers to search for.</li>
    <li><code>protocols</code>&nbsp;n array of {{domxref("DOMString")}} instances of federation protocols to search for.</li>
   </ul>
  </li>
  <li><code>unmediated</code>:&nbsp;a {{jsxref("Boolean")}} indicating&nbsp;a returned&nbsp;{{domxref("Credential")}} instances should not require user mediation.</li>
 </ul>
 </dd>
</dl>

<h3 id="Returns">Returns</h3>

<p>A&nbsp;{{jsxref("Promise")}} to a {{domxref("Credential")}} instance that matches the provided parameters.</p>

<h2 id="Example">Example</h2>

<pre class="brush: js">
// TBD</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Credential Management')}}</td>
   <td>{{Spec2('Credential Management')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(51.0)}}</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatChrome(51.0)}}</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>{{CompatChrome(51.0)}}</td>
  </tr>
 </tbody>
</table>
</div>
Revert to this revision