RTCIceServer.credentialType

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

Syntax

var iceServer = {
                  ...
                  credentialType = newCredentialType,
                  ...
                };

var credentialType = iceServer.credentialType;

iceServer.credentialType = newCredentialType;

Value

The permitted values are found in the RTCIceCredentialType enumerated string type:

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".

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

Specifications

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
Yes
≤79
47
No
?
No
No
Yes
47
?
No
Yes

See also

© 2005–2021 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