7
votes

I am getting Invalid platform app error while hitting oauth/access_token API on postman.

Note - for app_id i am using Instagram App Id.

Any solution for this?

{
    "error_type": "OAuthException",
    "code": 400,
    "error_message": "Invalid platform app"
}

https://api.instagram.com/oauth/access_token?app_id=54219xxxxx359344&app_secret=190fac2eaacxxxxxxxxxd83e1cc0c382ec7&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fankush2016.github.io%2F&code=AQBSckcUcZ6edpLQlnt2NBCFgfhyJYfEBNW_cFlseJ0R7P2fisA3OWAMU8-BJXbFh0RrKdX0Z7ccrpK7rbZOyQID8epfqcpIGGbUn4oAcdC-sCBYEn2nvuPpjlXoSg5Quv-lq1uiucbqIGKoxH0mDkKDp_QKxxxxxxxxxxxxxxxxxxxxelPn1FoVJqSWqaKbVDtt9rdDlP4n0-aRg__exYWGJ8vqKnp_8dGNxg

1
Did you ever figure this out??? I am having the same problem. - MontyTheMack
did you add yourself as a tester? - Noah Lc
For what it's worth, there is very fresh and recently attended bug ticket on fb dev (actually it is re-opened). there's even screenshot of the failed postman attempt. developers.facebook.com/support/bugs/647348279410026 - DingDong
@MontyTheMack suggested something. I tried using form-encoded via Postman call and it perfectly worked fine. Read more here [stackoverflow.com/questions/58488911/… - DingDong
Man, same here! Was two days lost and extremely upset about the docs leaving out this crucial detail! Even that fb guy who is on bug fix [developers.facebook.com/support/bugs/647348279410026/] was of no help. @MontyTheMack - DingDong

1 Answers

0
votes

In pseudo code format you may wish to use following configuration for your request:

baseURL = "https://api.instagram.com/oauth/access_token"

append = "client_id=\(API.INSTAGRAM_CLIENT_ID)&client_secret=\(API.INSTAGRAM_CLIENTSERCRET)&grant_type=authorization_code&redirect_uri=\(API.INSTAGRAM_REDIRECT_URI)&code=\(code)"

request.httpMethod = "Post"
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField:"Content-Type");