8

In my codeigniter project I am trying to use Instagram API for log in.

This is the library which I am using.

But when going to the login page, it is showing error

{"code": 403, "error_type": "OAuthForbiddenException", "error_message": "You are not a sandbox user of this client"}

The sample url is

https://www.instagram.com/oauth/authorize/?client_id=[client ID]&redirect_uri=[your url]&response_type=code

Why it is working like this? Any help could be appreciated

Arun
  • 3,640
  • 7
  • 44
  • 87

3 Answers3

11

As per this error:

{"code": 403, "error_type": "OAuthForbiddenException", "error_message": "You are not a sandbox user of this client"}

First of all you need to create Sandbox User:

Step1:

Login your account from here "http://instagram.com/developer" and than click on Manage Clients for creating New Client, make sure status of client is Sandbox.

Step2:

Fill all required fields and set OAuth redirect_uri field to "http://localhost" without using quotes. also unchecked Disable implicit OAuth

Step 3:

Now you can see the client id on Client Detail box, now you just need to generate Access Token for access API, you can use this URL:

https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID_HERE]&redirect_uri=http://localhost&response_type=token

You can check the status of Client from here: enter image description here

Reference: http://jelled.com/instagram/access-token

devpro
  • 16,184
  • 3
  • 27
  • 38
  • 1
    No success. I have did that steps but issue "You are not a sandbox user" didn't resolved – Argus Mar 18 '19 at 18:41
  • 1
    @argus disable implicit oauth – devpro Mar 18 '19 at 18:43
  • @Argus did you ever figure this out? Or did Instagram change their api? – Rich Apr 10 '19 at 17:34
  • @Rich: i used this API yesterday for my new client, and its working as mentioned in answer – devpro Apr 10 '19 at 17:36
  • @devpro, odd, I seem to be struggling with it today :/ – Rich Apr 10 '19 at 17:37
  • @devpro 403:"OAuthForbiddenException" I just did a sanity check with a new sandbox project and while I can verify the user that created the sandbox, I no longer seem able to invite another instagram account to use the sandbox app. – Rich Apr 10 '19 at 17:47
  • @Rich yes. And as a result I have posted my own answer in this topic. You can scroll a bit to see it. – Argus Apr 11 '19 at 07:16
3

In such error case:

{"code": 403, "error_type": "OAuthForbiddenException", "error_message": "You are not a sandbox user of this client"}

You need to add that Instagram user to Sandbox Users:

Step1:

Go https://www.instagram.com/developer/clients/manage/

Press Manage.

Press Sandbox.

Step2:

Type Instagram ID of user you getting that error add and press Save. You will see pending in front of user you added.

Step 3:

Now you need to accept invitation. Login into that Instagram account on the https://www.instagram.com.

Go to https://www.instagram.com/developer/clients/sandbox_invites/

http://joxi.ru/l2ZRDDPFzV9GK2.jpg

Press Accept.

Done! Now should work.

Argus
  • 2,241
  • 1
  • 22
  • 27
1

In addition to the already provided answers:

Check the account you're logged in on Instagram

You cannot be logged in to account A and request a token for account B.

This is a simple answer, but I just spent 15 minutes figuring this out, because I'm logged in to different accounts under different Chrome windows.

Timofey Drozhzhin
  • 4,416
  • 3
  • 28
  • 31