Error: invalid_request device_id and device_name are required for private IP

后端 未结 6 485
眼角桃花
眼角桃花 2020-11-30 08:53

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

6条回答
  •  生来不讨喜
    2020-11-30 09:21

    Google will not accept a local (private) IP address when doing Oauth calls. My workaround was to add an entry in my Windows hosts file for the local IP:

    \Windows\System32\drivers\etc

    192.168.1.2   fakedomain.com
    

    then register fakedomain.com with Google in their dev console. That appears as a "real" domain to them, but will still resolve in your browser to the local IP. I'm sure a similar approach on Mac or Linux would also work.

提交回复
热议问题