W3cubDocs

/Web APIs

RTCIceServer: credentialType property

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The RTCIceServer dictionary's credentialType property is a string value which indicates what type of credential the RTCIceServer.credential value is. The default is password.

Syntax

js

const iceServer = {
  // ...
  credentialType: newCredentialType,
  // ...
};

const credentialType = iceServer.credentialType;

iceServer.credentialType = newCredentialType;

Value

The permitted values are:

oauth

The RTCIceServer requires the use of OAuth 2.0 to authenticate in order to use the ICE server described. This process is detailed in RFC 7635. This property was formerly called token.

password

The RTCIceServer requires a username and password to authenticate prior to using the described ICE server.

Example

This example creates a new RTCPeerConnection which will use a TURN server at turnserver.example.org to negotiate connections. Logging into the TURN server will use the username "webrtc" and the creative password "turnpassword".

js

const myPeerConnection = new RTCPeerConnection({
  iceServers: [
    {
      urls: "turn:turnserver.example.org", // A TURN server
      username: "webrtc",
      credential: "turnpassword",
      credentialType: "password",
    },
  ],
});

Specifications

This feature is not part of any current specification.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
credentialType No ≤79 47 No No No No No 47 No No No

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCIceServer/credentialType