0

Uncaught DOMException: Failed to construct 'RTCPeerConnection': Both username and credential are required when the URL scheme is "turn" or "turns".

I have getting error.

My code and coturn config are.

const iceConfiguration = {
        iceServers: [
            {
                username: 'myuser',
                credentials: 'userpassword',
                urls: [
                    'turn:public_ip_address:3478?transport=tcp',
                ]
            }
        ]
    }
    let peer = new RTCPeerConnection(iceConfiguration);
listening-port=3478

tls-listening-port=5349

listening-ip= turn:public_ip_address

external-ip= turn:public_ip_address

relay-ip= turn:public_ip_address

fingerprint

lt-cred-mech

user=myuser:userpassword

I tried write urls without array[ ] but same result.

What can I do?

Miguel
  • 377
  • 1
  • 17

2 Answers2

1

The specification says the property is credential, not credentials. Did you find the wrong spelling in a particular place?

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
0

I think the error was caused by typo "credential"

Can you try again with:

const iceConfiguration = {
        iceServers: [
            {
                username: 'myuser',
                credential: 'userpassword',
                urls: 'turn:public_ip_address:3478?transport=tcp'
            }
        ]
    }
    let peer = new RTCPeerConnection(iceConfiguration);

Coturn can be tested by WebRTC samples Trickle ICE

Here has some detailed TURN server test info

Hope these info helps.

Sean Jiang
  • 1
  • 1
  • 1