iospostsingle-sign-ondisqus

Disqus SSO, "Your API key is not valid on this domain"


I'm making API call to Disqus from an application in iOS. Since my users are authenticated already on my web site, I don't want them to authenticate again with Disqus. Disqus has a way to solve this with SSO (Single Sign-On). I have followed the guide here. I have successfully checked the validation on SSO payload and made a sample request in console.

But when I implement the API call from my application I receive :

{
    "code":11,
    "response":"Your API key is not valid on this domain"
}

I don't know what I do wrong in my code. Could anyone point me to go further ?


Solution

  • There is a text box in your Disqus API application settings that lets you specify domains that your public API key is valid on. This error is being thrown because the referrer and host domains don't match any of the ones listed in your application.

    Since this is an iOS application, you must set the 'host' and 'referrer' headers to match a domain listed in your application settings. I've confirmed that it works when using this answer:

    How to set Http header Fields in Objective-C?