问题
I have the following code.
params = {'client_id':settings.SOCIAL_AUTH_INSTAGRAM_KEY,
'client_secret':settings.SOCIAL_AUTH_INSTAGRAM_SECRET,
'aspect':'media',
'object':'tag',
'object_id':instance.hashtag,
'callback_url':
'http://subdomain.domain.net:8000/campaigns/hook'}
response = requests.post('https://api.instagram.com/v1/subscriptions',
data=params)
And I get response
'{"meta":{"error_type":"APISubscriptionError","code":400,"error_message":"Invalid response"}}'
My domain is reachable from outside. Any ideas?
回答1:
This was because Instagram sends a GET request to my callback_url
and wants me to response with hub.challenge
parameter like below
if self.request.GET:
response = request.GET.get('hub.challenge')
return HttpResponse(response)
来源:https://stackoverflow.com/questions/19607375/instagram-invalid-response-error-400