1
我在rails/ember應用程序中玩弄omniauth,並且在谷歌登錄時點擊了一面牆。我得到了彈出窗口以允許該網站驗證了我,但點擊接受請求炸彈出來後:Google oauth在本地開發中被阻止
Uncaught SecurityError: Blocked a frame with origin "https://localhost:3001" from
accessing a frame with origin "https://accounts.google.com". Protocols, domains,
and ports must match.
我使用自簽名證書來獲得HTTPS地方發展,但我怎麼在本地測試這個權威性的邏輯?
的CoffeeScript試圖做標誌的:
$ ->
$.ajax
url: '//apis.google.com/js/client:plus.js?onload=gpAsyncInit'
dataType: 'script'
cache: true
window.gpAsyncInit = ->
$(".google-login").click (e) ->
e.preventDefault()
gapi.auth.authorize
immediate: false
response_type: "code"
client_id: "<%= ENV["GOOGLE_CLIENT_ID"] %>"
scope: "email profile"
, (response) ->
if response and not response.error
jQuery.ajax
type: "POST"
url: "/auth/google_oauth2/callback"
dataType: "json"
data: response
success: (json) ->
alert 'success!'
else
alert response.error