Skip to content

Browser Hangs when allowing #186

Open

Description

@chrisjoly

Hi Sirkris,

I have an issue, and I don't know where to go to solve it, so I'll post it here.

I implemented the code that you have here, following all the instructions, and all the parameters are correct, but when I accept, the browser just hangs there, and doesn't do anything. No responses of such.

When I did it initially, I did get an email confirming I authorized my app to have access to my reddit account, but I don't get any tokens returned to me.

What do you think would be the cause of this?

Sincerely,

Chris Joly

Activity

  1. self-assigned this
    on Aug 8, 2024
  2. sirkris commented on Aug 8, 2024

    @sirkris
    Owner

    Can you provide the specific code you used?

  3. added
    Awaiting FeedbackAdditional information is required before the issue can be resolved.
    on Aug 8, 2024
  4. chrisjoly commented on Aug 8, 2024

    @chrisjoly
    Author

    public RedditClient logIntoReddit(Dictionary<string, string> credentials = null)
    {
    if (credentials == null)
    {
    // Hard Coded API credentials
    }
    else {
    string appId = credentials["appId"];
    string appSecret = credentials["appSecret"];
    string userAgent = credentials["userAgent"];
    int port = int.Parse(credentials["port"]);

    }
    

    // authTokenRetriever is a variable declared at the class level
    this.authTokenRetriever = new Reddit.AuthTokenRetriever.AuthTokenRetrieverLib(appId, port,"localhost", null, appSecret);

    // Start the callback listener.  --Kris
    // Note - Ignore the logging exception message if you see it.  You can use Console.Clear() after this call to get rid of it if you're running a console app.
    authTokenRetriever.AwaitCallback();
    
    
    //// Replace this with whatever you want the app to do while it waits for the user to load the auth page and click Accept.  --Kris
    RedditClient rdtClient;
    
    // Get the authorization URL
    
    string authorizationUrl = authTokenRetriever.AuthURL();
    
    Console.WriteLine("Please visit the following URL to authorize your application:");
    OpenBrowser(authorizationUrl);
    Console.WriteLine("After authorization, paste the code you received here:");
    
    // Read the authorization code from the console input
    string authorizationCode = Console.ReadLine();
    
    // Retrieve the refresh token
    try
    {
    
        string refreshToken = authTokenRetriever.RefreshToken;
        Console.WriteLine("Your refresh token is: " + refreshToken);
    }
    catch (Exception ex)
    {
        Console.WriteLine("An error occurred: " + ex.Message);
    }
    
    rdtClient = new RedditClient(appId, authTokenRetriever.RefreshToken, appSecret, null, userAgent);
    return rdtClient;
    

    }

    image

    It's been hanging for the past few minutes

  5. chrisjoly commented on Aug 8, 2024

    @chrisjoly
    Author

    MSVBot is the name of the application
    Many-Sirs-4588 is my Username

    redditApp

  6. sirkris commented on Aug 10, 2024

    @sirkris
    Owner

    Hmm could there be a firewall or some other routing issue? Are you sure it's binding to port 8080 successfully? Maybe try a different port and see what happens?

  7. chrisjoly commented on Aug 13, 2024

    @chrisjoly
    Author

    It's most likely the case! I have Norton, and their firewall is pretty robust! I have no idea how to allow ports through!
    I've tried a few other ports, but no dice!

    Is there a programmatic way to open the port?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Awaiting FeedbackAdditional information is required before the issue can be resolved.questionSomebody asked a question.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions