Skip to content

Commit 7bb135d

Browse files
author
Dave Mun
committed
Added IAT claim to JWT, switched header to X-OPENTOK-AUTH
1 parent 613e536 commit 7bb135d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

opentok/opentok.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def headers(self):
275275
"""For internal use."""
276276
return {
277277
'User-Agent': 'OpenTok-Python-SDK/' + __version__ + ' ' + platform.python_version(),
278-
'X-TB-OPENTOK-AUTH': self._create_jwt_auth_header()
278+
'X-OPENTOK-AUTH': self._create_jwt_auth_header()
279279
}
280280

281281
def archive_headers(self):
@@ -451,7 +451,8 @@ def _create_jwt_auth_header(self):
451451
payload = {
452452
'ist': 'project',
453453
'iss': self.api_key,
454-
'exp': int(time.time()) + (60*5), # 5 minutes
454+
'iat': int(time.time()), # current time in unix time (seconds)
455+
'exp': int(time.time()) + (60*3), # 3 minutes in the future (seconds)
455456
'jti': '{:f}'.format(random.random())
456457
}
457458

0 commit comments

Comments
 (0)