Example #1
0
def generate_access_token(context, duration=ONE_MINUTE):
    access_token = AuthenticationToken(context.client_config['ACCESS_SECRET'],
                                       duration)
    account = context.accounts[context.username]
    access_token.generate(account.id)

    return access_token
Example #2
0
def generate_refresh_token(context, duration=TWO_MINUTES):
    refresh_token = AuthenticationToken(
        context.client_config['REFRESH_SECRET'], duration)
    account = context.accounts[context.username]
    refresh_token.generate(account.id)

    return refresh_token
    def _generate_reset_token(self):
        reset_token = AuthenticationToken(self.config['RESET_SECRET'],
                                          ONE_HOUR)
        reset_token.generate(self.account.id)

        return reset_token.jwt