Latest 1.0.2
License MIT
Platforms ios 8.0

Wrapper for Disqus APIs written in Swift.
This open-source library allows you to integrate it into your iOS apps.
Learn more about Disqus APIs.

Language Swift 3.0
Platforms iOS
License MIT


DisqusService is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'DisqusService'


Add the following code in your AppDelegate class

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
    DisqusService.shared.set(publicKey: "<your-public-key>",
                             secretKey: "<your-secret-key>",
                             redirectURI: "<your-redirect-uri>")

@available(iOS 9.0, *)
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    if let sourceApplication = options[.sourceApplication] as? String {
        if sourceApplication == "" {
   .DisqusServiceSafariAuthDidClose, object: url)
    return true

Because Disqus APIs don’t support schemes to redirect your app after OAuth authentication, you MUST provide an URL which then redirects to the following scheme: disqus-redirect://.
To do so in Project Settings → Info: scroll down to URL Types and add an entry with +

  • Identifier: your-app-bundle-id, i.e. com.disqusService.testApp
  • URL Schemes: disqus-redirect

Authenticating/Deauthenticating a user is very simple:

DisqusService.shared.authenticate(viewController: yourVC) { (success) in
    if success {

    } else {




This library also includes a convenient class called DisqusComment to better handle received comments from a thread.
Here’s an example:

let params = ["thread" : "<your-thread-id>", "order" : "asc"]
let posts: [DisqusComment] = []

DisqusService.shared.performGETRequest(api: "posts/list", authRequired: false, params: params) { (data, success) -> Void in
    if success {
        let posts = data?["response"] as! [[AnyHashable : Any]]

        for postJSON in posts {
            if let post = DisqusComment(disqusData: postJSON) {

Please note that certain APIs require authentication and MUST be specified.
API usage example:

let paramsDetails = ["forum" : "<your-forum>", "thread" : "<your-thread-id>"]
DisqusService.shared.performGETRequest(api: "threads/details", authRequired: false, params: paramsDetails) { (data, success) in


let paramsVote = ["post" : "<your-post-id>", "vote" : "1"]
DisqusService.shared.performPOSTRequest(api: "posts/vote", authRequired: true, params: paramsVote) { (data, success) in



Matteo Riva, [email protected]


DisqusService is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "DisqusService",
    "version": "1.0.2",
    "summary": "Wrapper for Disqus APIs written in Swift",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "ascarrambad": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "1.0.2"
    "source_files": "Sources/*.swift"

Pin It on Pinterest

Share This