Ngừng hoạt động một phầnshare-external
Getting issue in implementing Instagram OAuth
1

Hey All,

I am working on a project in Django where I am trying to implement the get the authentication using Instagram and get the 'access_token'.

I have create an app on Meta for Dev (https://developers.facebook.com/apps) as a Business App type.

I added all the details in the dashboard and also the redirect URL in the 'App settings/advance' section.

Below is the code of {url}/oauth/login

@csrf_exempt
def instagram_login(request):
    auth_url = 'https://api.instagram.com/oauth/authorize'
    params = {
        'client_id': settings.INSTAGRAM_CLIENT_ID,
        'redirect_uri': settings.INSTAGRAM_REDIRECT_URI,
        'response_type': 'code',
        'scope': 'user_profile,user_media'
    }
    return redirect(f'{auth_url}?{urlencode(params)}')

This function is supposed to returns the user's oauth token upon successful authorizing the my app.

client_id: From the app's dashboard/settings/basic/ named as App ID redirect_uri: The screenshot of redirect uri is attached which I have added on the developer's dashboard.

Error:

// 20240728142633
// https://www.instagram.com/oauth/authorize?client_id={my_client_id}&redirect_uri=https://c6de-60-243-89-185.ngrok-free.app/oauth/callback&response_type=code&scope=user_profile,user_media&logger_id=96c53a11-09b9-4a13-a00b

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

Please help me out with this issue. If any other data details are required, I'll be happy to provide. Thanks in advance!

Prince
Đã hỏi khoảng 5 tháng trước