Encoded Base String

View as MarkdownOpen in Claude

The Encoded Base String for the standard requests is composed of the Method, ”&”, URL, ”&”, and OAuth params combined as a sorted string.

Both the URL and the parameter string must be URI escaped according to Rfc3986.

1params_string = "&".join([f"{k}={v}" for k, v in sorted(oauth_params.items())])
2method = 'POST'
3url = f'https://{baseUrl}/oauth/live_session_token'
4base_string = f"{method}&{quote_plus(url)}&{quote(params_string)}"
5encoded_base_string = base_string.encode("utf-8")