I was doing my development with Google Drive API using [localhost:8080]. Suddenly I felt to test it in my local deployment sandbox and it has IP address as [192.168.1.1:8080
Edit: Only relevant when developing locally.
Ok, I'm having the same problem on my Mac. Following steps resolved the issue
Go to your google development console https://console.developers.google.com/project, choose credentials and change the callback IP to a domain like http://myflask.com:5000/oauth2callback. In my case I am using a Flask application, so the 5000 port is necessary.
Next add to your private/etc/hosts file a new entry matching the above hostname to your IP, like so:
# (example IP)
172.1.1.1 myflask.com
Give Google a minute to update your credentials, and visit your site at http://myflask.com:5000