2014-01-25 129 views
0

我在將Dropbox API與Chrome擴展程序集成時遇到問題。嘗試驗證Dropbox後,重定向到Dropbox確認/許可頁面可以正常工作,但重定向回Chrome應用程序失敗。這是控制檯中的錯誤:Chrome擴展程序中的Dropbox API:否認Chrome擴展程序的加載:// [...]

Denying load of chrome-extension://mlabibnomhfmephibijgghejmmmbigpi/chrome_oauth_receiver.h…sGbCG&token_type=bearer&uid=14169733&state=oas_hquvrf6k_0.ycudjb24vysexw29. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension. 

看來,Chrome正在阻止Dropbox重定向回擴展名中的頁面。幾個小時的權限試驗完全沒有結果。

這裏的manifest.json

{ 

    "name": "MyApp", 
    "description": "Description", 
    "version": "1.0", 
    "icons": {"16":"icon.png", 
        "48":"icon.png", 
        "128":"icon.png"}, 


    "manifest_version": 2, 

    "permissions": [ 
    "http://*/*", 
    "https://*/*", 
    "<all_urls>", 
    "tabs", 
    "storage", 
    "background", 
    "bookmarks", 
    "clipboardRead", 
    "clipboardWrite", 
    "contentSettings", 
    "contextMenus", 
    "cookies", 
    "debugger", 
    "history", 
    "idle", 
    "management", 
    "notifications", 
    "pageCapture", 
    "topSites", 
    "webNavigation", 
    "webRequest", 
    "webRequestBlocking" 
    ], 

    "background": { 
    "scripts": ["backgroundcollector.js"] 
    }, 

    "browser_action": { 
    "default_icon": "icon.png" 
    }, 

    "web_accessible_resources": [ 
    "http://*/*", 
    "https://*/*", 
    "<all_urls>", 
    "chrome-extension://mlabibnomhfmephibijgghejmmmbigpi/chrome_oauth_receiver.html&response_type=token&state=oas_hquul1r4_0.1qwu7sh12pqzolxr", 
    "chrome-extension://*/*" 
    ], 

    "content_security_policy": "script-src 'self' https://www.dropbox.com; object-src 'self'", 

    "key": "(included so that the extension gets a persistent extensionID)" 

} 

(大數量的權限是很多試驗,以得到這個工作的結果。顯然,它們會在稍後刪除。)

在感謝提前!

回答

1

你有垃圾的卡車在你的清單文件...
要允許其他網頁到您的擴展中重定向到一個頁面,你必須把這個文件在"web_accessible_resources",沒有chrome-extension://..前綴,這樣:

"web_accessible_resources": [ 
    "chrome_oauth_receiver.html" 
], 

您應要求儘可能少的權限可能看到Declare permissions爲每個權限描述的列表。我想你可以在閱讀該文檔後襬脫幾乎所有的許可。