Hugging Face and Gradio URL Paramiters

I’m developing a project for a space on Hugging Face that uses Gradio. The project first sends the user to Twitter with an API request and after validating they are then retuned to my Hugging Face space with their oauth_verifier and oauth_token in the url header. When running Gradio locally on my machine I was able to use the below code to access the URL headers, however, after uploading the project to Hugging Face the function returns two empty strings (when the parameters are in the URL).

Does anyone know if there is a more reliable way of retrieving the current URL parameters when running on Hugging Face/ when using Gradio?

Any help would be appreciated,

block = gr.Blocks()
def get_oath_headers():
    oauth_verifier = None
    oauth_token = None
    did_find = False
    if hasattr(block, "server"):
        for connection in block.server.server_state.connections:
            if connection.headers != None:
                for header in connection.headers:
                    header = header[1].decode()
                    if "oauth_verifier" in header:
                        oauth_verifier ="oauth_verifier=(.+)", header).group(1)
                        oauth_token ="oauth_token=(.+)&", header).group(1)
                        if oauth_token and oauth_verifier:
                            did_find = True
                if did_find:
    return oauth_verifier, oauth_token