C# Instagram - Invalid Scope

孤街浪徒 提交于 2021-01-28 03:51:17

问题


I'm creating a site where I want to show Instagram posts. I need access_token, so I'm following the flow, trying to get "code" Once it worked, but never again...

The message is always

"{"error_type": "OAuthException", "code": 400, "error_message": "Invalid scope field(s): basic,user_profile,user_media"}"

string authUri = "https://api.instagram.com/oauth/authorize/?client_id=" + _clientID +
                    "&redirect_uri=" + redirectUri +
                    "&scope=user_profile,user_media" +
                    "&response_type=code";

        Process.Start(authUri);

I've tried to remove scope line, then the error is Invalid scope field(s): basic When I used with scope=basic, same message, Invalid scope field(s): basic

I've tried with Instagram clientID/token, same error, tried with Instagramm ID/Secret in Facebook App, same error.

Any ideas maybe ?

Thanks in advance


回答1:


This started happening yesterday.

Instagram deprecated the basic scope on Jun 29 (yesterday). It looks like they might have a bug that causes basic to be added to any valid scopes that you ask for. This seems to be, in effect, disabling the whole oauth functionality.

Hopefully they will fix this? But who knows.

You might just have to wait.




回答2:


Yeah, the API has been deprecated today (June 30th).

The URL should be https://www.instagram.com/oauth/authorize/?client_id=CLIENTID&redirect_uri=REDIRECTURI&response_type=code&scope=instagram_graph_user_media

but as @david wrote before me, something is broken right now because the "basic" permission is added into any request.

UPDATE July 4, 2020

Got it fixed. Had to create a new Instagram app from Facebook , then replace the client ID with the new one, update client secret, update the call URLs, create new test users, update the tokens, and generally update the entire code because the returned results from the endpoints are completely different format now. Quite some work. But it is working now.




回答3:


I got that same exact error response:

{"error_type": "OAuthException", "code": 400, "error_message": "Invalid scope field(s): basic,user_profile,user_media"}

I fixed it by changing the old, outdated INSTAGRAM_CLIENT_ID to the new INSTAGRAM_APP_ID. You can find it in your https://developers.facebook.com/apps. Make sure you grab the APP_ID specifically for the Instagram basic display product, not your overall Facebook App ID

https://api.instagram.com/oauth/authorize?client_id={THE NEW APP ID, not the old client ID} & {the rest of the params} 


来源:https://stackoverflow.com/questions/62647917/c-sharp-instagram-invalid-scope

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!