def METHOD_NAME(self, user, nonce, url_part):
    assert nonce is not None, 'No nonce passed'
    params = {
        'nonce': nonce,
        'email': user.email,
        'external_id': user.id,
        'username': user.forum_username,
        'name': user.name,
        'custom.user_field_1': user.id,
    }
    key = self.sso_key.encode('utf-8')
    r_payload = b64encode(urllib.parse.urlencode(params).encode('utf-8'))
    h = hmac.new(key, r_payload, digestmod=hashlib.sha256)
    qs = urllib.parse.urlencode({'sso': r_payload, 'sig': h.hexdigest()})
    return '%s%s?%s' % (self.discourse_public_url, url_part, qs)