'Create a BearerToken, by default without refresh token.'

def create_token(self, request, refresh_token=False, save_token=True):

    if callable(self.expires_in):
        expires_in = self.expires_in(request)
    else:
        expires_in = self.expires_in
    request.expires_in = expires_in
    token = {u'access_token': self.token_generator(request), u'expires_in': expires_in, u'token_type': u'Bearer'}
    if (request.scopes is not None):
        token[u'scope'] = u'    '.join(request.scopes)
    if (request.state is not None):
        token[u'state'] = request.state
    if refresh_token:
        if (request.refresh_token and (not self.request_validator.rotate_refresh_token(request))):
            token[u'refresh_token'] = request.refresh_token
        else:
            token[u'refresh_token'] = self.refresh_token_generator(request)
    token.update((request.extra_credentials or {}))
    token = OAuth2Token(token)
    if save_token:
        self.request_validator.save_bearer_token(token, request)
    return token
