Commit 201a596c by Jérome Perrin

access_token: use os.urandom to generate token

Using same method as python 3.6's secrets module and a bit longer token
that what python currently recommends, since we were using very very
long tokens until now (so that it does not look like a "regression")
parent 758fc366
alpha = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
random_id = ''
for _ in range(0, 128):
random_id += random.choice(alpha)
import os
import base64
# This is python 3.6 secret.token_urlsafe
random_id = base64.urlsafe_b64encode(os.urandom(48)).rstrip(b'=').decode('ascii')
# Define Reference from ID provided by portal_ids
portal = context.getPortalObject()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment