Gabor85
Gabor85

Reputation: 135

C# Instagram - Invalid Scope

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

Upvotes: 4

Views: 7438

Answers (6)

Nick Hoàng
Nick Hoàng

Reputation: 437

This error is because your app lacks permissions, just request two more permissions as showing in the screenshot below and you won't see that error I believe

enter image description here

Upvotes: 0

Asad Ali
Asad Ali

Reputation: 131

you can simply use:


    https://api.instagram.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&scope=user_profile,user_media&response_type=code

NOTE: redirect_uri must be in https

Upvotes: 1

Jose Ortega
Jose Ortega

Reputation: 1040

I've faced this today what I did was 2 things:

  • Clear your browser's cookies (make sure to clear all cookies, with the "all the time" option, not last 1 week or whatever).

  • Reset the secret on the ap

Upvotes: 0

Aeisys
Aeisys

Reputation: 367

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} 

Upvotes: 1

Jessica Brohns
Jessica Brohns

Reputation: 41

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.

Upvotes: 3

David
David

Reputation: 788

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.

Upvotes: 2

Related Questions