简体   繁体   中英

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 website, 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 ?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM