Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser Hangs when allowing #186

Open
chrisjoly opened this issue Aug 8, 2024 · 5 comments
Open

Browser Hangs when allowing #186

chrisjoly opened this issue Aug 8, 2024 · 5 comments
Assignees
Labels
Awaiting Feedback Additional information is required before the issue can be resolved. question Somebody asked a question.

Comments

@chrisjoly
Copy link

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

@sirkris sirkris self-assigned this Aug 8, 2024
@sirkris sirkris added the question Somebody asked a question. label Aug 8, 2024
@sirkris
Copy link
Owner

sirkris commented Aug 8, 2024

Can you provide the specific code you used?

@sirkris sirkris added the Awaiting Feedback Additional information is required before the issue can be resolved. label Aug 8, 2024
@chrisjoly
Copy link
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

@chrisjoly
Copy link
Author

chrisjoly commented Aug 8, 2024

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

redditApp

@sirkris
Copy link
Owner

sirkris commented Aug 10, 2024

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?

@chrisjoly
Copy link
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
Labels
Awaiting Feedback Additional information is required before the issue can be resolved. question Somebody asked a question.
Projects
None yet
Development

No branches or pull requests

2 participants