sirkris / Reddit.NET

A Reddit API library for .NET Standard with OAuth support. Written in C#.
MIT License
500 stars 77 forks source link

redirect_uri invalid error with AuthTokenRetriever on macOS #177

Closed bumblemeow closed 1 year ago

bumblemeow commented 1 year ago

I tried running the AuthTokenRetriever on macOS (Big Sur) and I kept getting an error in the opened browser for "redirect_uri invalid". When I modified Program.cs to output the AuthURL before sending it I noticed that redirect_uri was being set to 'http://127.0.0.1:8080/Reddit.NET/oauthRedirect' instead of 'http://localhost:8080/Reddit.NET/oauthRedirect'.

So if anyone sees the redirect_uri invalid error, just make sure you use 'http://127.0.0.1:8080/Reddit.NET/oauthRedirect'

I also updated all the .csproj files to use TargetFramework = "net7.0" instead of .net core 2.1. I'm not sure if that has anything to do with the error.

sirkris commented 1 year ago

So you're saying the browser was changing the host? I don't know much about Macs so I'm not much help here, but it sounds like you found a workaround. Back in the 5.x days of PHP, I remember the php_mysql library had a weird bug where you had to specify 127.0.0.1 instead of localhost but that was ages ago.