How to configure WebRTC using Coturn and oAuth

I want to use coturn with oAuth . If I understood correctly, I need to do two things:

  • Storing oAuth tokens in coturn database uses
  • Sending ACCESS-TOKEN and USERNAME STUN Attributes

The first point is clear, but how do I need to change my WebRTC client to reach the second point?

Without oAuth, I would initialize my RTCPeerConnection as follows:

 var configuration = { 'iceServers': [{ 'url': 'turn:turn.example.org', 'username': 'user', 'credential': 'password' }] }; var pc = new RTCPeerConnection(configuration) 

The WebRTC 1.0 project defines an RTCIceCredentialType enumeration, so I think I need to change my configuration as follows:

 var configuration = { 'iceServers': [{ 'url': 'turn:turn.example.org', 'username': 'kid', 'credential': 'oAuthToken', 'credentialType': 'token' }] }; 

Using Wireshark I do not see the ACESS-TOKEN . Any ideas or does anyone know a working example?

+8
oauth webrtc stun turn rfc5766turnserver
source share
1 answer

It seems that some things have changed a bit since the original question was asked. webrtc-pC # 1033 pull-request modifies the specification and introduces the following iceServers syntax:

 var configuration = { 'iceServers': [{ "urls": "turns:turn.example.net", "username": "username", "credential": { "macKey": "...", "accessToken": "..." }, "credentialType": "oauth" }], ... } 

See RTCIceServer more details on configuration examples.

+1
source share

All Articles