The RTCIceServer dictionary's username property is a string which specifies the username to use when authenticating with the ICE server being described.

Note: This value is used when the RTCIceServer describes a TURN server.


const iceServer = {
  // ...
  username: someUsername,
  // ...

const username = iceServer.username;

iceServer.username = newUsername;


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


WebRTC: Real-Time Communication in Browsers
# dom-rtciceserver-username

Browser compatibility

BCD tables only load in the browser

See also