Error 401 Unauthorized on deployed website but not localhost


I had a Twitter app that was working fine. I needed to change the site URL, so I updated the app settings with the new URL. Now I get error 401 (Unauthorized) when I try to log in via Twitter.

However, I do not get this issue when I debug the site locally (localhost). Can someone please help me figure out what can be causing this?