使用开源项目google-api-ruby-client,我正在尝试运行 OAuth 2.0 示例 calendar.rb,它将访问 Google Calendar API。我在 Google API 控制台中创建了客户端 ID,并在 ruby 脚本中填写了客户端 ID 和密钥。
但是,在我运行 ruby 脚本之后
ruby calendar.rb
然后打开http://localhost:4567,浏览器从谷歌返回错误信息给我:
Error: redirect_uri_mismatch
The redirect URI in the request: http://localhost:4567/oauth2callback did not match a registered redirect URI
我检查了 Google API 控制台中的信息:
Redirect URIs: https://localhost/oauth2callback
JavaScript origins: https://localhost
有什么问题以及如何解决?提前致谢。