Error: invalid_request device_id and device_name are required for private IP

后端 未结 6 488
眼角桃花
眼角桃花 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:10

    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

提交回复
热议问题