2015-07-21 116 views
3

錯誤的Instagram:重定向URI不匹配,註冊重定向URI

{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI does not match registered redirect URI"} 

上出現了

https://instagram.com/oauth/authorize?response_type=code&client_id=2fa4359e4340434786e469ab54b9b8c0&redirect_uri=http://localhost:8000&scope=likes 

Instagram的設置

CLIENT ID 2fa4359e4340434786e469ab54b9b8c0 
WEBSITE URL http://localhost:8000/ 

代碼

$authProvider.oauth2({ 
    name: 'instagram', 
    url: 'http://localhost:3000/auth/instagram', 
    redirectUri: 'http://localhost:8000', 
    clientId: '2fa4359e4340434786e469ab54b9b8c0', 
    requiredUrlParams: ['scope'], 
    scope: ['likes'], 
    scopeDelimiter: '+', 
    authorizationEndpoint: 'https://api.instagram.com/oauth/authorize' 
}); 

任何幫助將不勝感激。謝謝!

回答

0

當您在Instagram上創建開發者帳戶時,系統會提示您輸入重定向URI。您在您的應用中使用的重定向URI進行身份驗證必須匹配註冊的URI。

4

你需要URL編碼的redirect_uri參數的值,以http%3A%2F%2Flocalhost%3A8000防止了scope參數成爲redirect_uri值,而不是授權請求的一部分。

您還必須確保redirect_uri完全匹配,包括您註冊的最後一個斜槓。

那麼接下來的授權請求變爲:

https://instagram.com/oauth/authorize?response_type=code&client_id=2fa4359e4340434786e469ab54b9b8c0&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=likes 
0

請檢查this answer

基本上你需要設置您的重定向URI在這兩個您的應用程序和Instagram到:IG <CLIENT_ID>://授權

在所有情況下,你需要追加/授權或類似的東西,不知何故Instagram不允許只有一個網站沒有ubdomain。