@@ -155,20 +155,23 @@ Visit `http://localhost:3000/health` to verify:
155
155
156
156
### JWT Token Generation
157
157
158
- The Flask app generates JWT tokens according to the [ SignalWire Browser SDK v2 documentation ] ( https://developer.signalwire.com/sdks/browser-sdk/v2/ ) :
158
+ The Flask app generates JWT tokens using the SignalWire REST API endpoint :
159
159
160
160
``` python
161
+ # Request to SignalWire REST API
162
+ url = f " https:// { SIGNALWIRE_SPACE } /api/relay/rest/jwt "
161
163
payload = {
162
- " iss" : SIGNALWIRE_PROJECT_ID , # Issuer (your project)
163
- " sub" : f " user- { uuid.uuid4()} " , # Subject (unique user)
164
- " iat" : int (now.timestamp()), # Issued at
165
- " exp" : int ((now + timedelta(hours = 1 )).timestamp()), # Expires in 1 hour
166
- " jti" : str (uuid.uuid4()), # JWT ID (unique token)
167
- " resource" : " browser" , # Resource type
168
- " scopes" : [" webrtc" ] # Required scopes
164
+ " resource" : f " browser- { uuid.uuid4()} " , # Unique resource identifier
165
+ " expires_in" : 60 # Token expires in 60 minutes
169
166
}
167
+
168
+ # Authentication using project ID and token
169
+ auth = (SIGNALWIRE_PROJECT_ID , SIGNALWIRE_TOKEN )
170
+ response = requests.post(url, json = payload, auth = auth)
170
171
```
171
172
173
+ This approach uses SignalWire's official JWT generation endpoint rather than manually creating JWT tokens.
174
+
172
175
### The Fix Implementation
173
176
174
177
The fix is in ` packages/common/src/webrtc/BaseCall.ts ` :
0 commit comments