[Aerogear-users] AeroGear SDK integration with Keycloak

Ashish Pandita Ashish.Pandita at indegene.com
Thu Apr 28 07:44:05 EDT 2016

Hi All,

I am having some trouble using aerogear to connect keycloak locally. I am using shoot example I did the following things
1) installed pods on shoot&share https://github.com/aerogear/aerogear-ios-cookbook/tree/0.3.0/Shoot
2) installed the key cloak ver keycloak-1.9.2.Final (https://github.com/aerogear/aerogear-backend-cookbook/tree/master/Shoot) I can access the admin console in browser imported the realm configuration https://github.com/aerogear/aerogear-backend-cookbook/blob/master/Shoot/configuration/shoot-realm.json
3) I run the server attached is the log and here is the terminal rec https://asciinema.org/a/7xhosmb63kn9tnvn99gnh5mbm
4) I am not able to login to keycloak. I am getting errors in console when keycloak launches the web view can you please help what need to be done to resolve it or guide to proper resource.

here is the Aerogear API which I am using

 @IBAction func shareWithKeycloak() {

        let keycloakHost = "http://localhost:8080"
        let keycloakConfig = KeycloakConfig(
            clientId: "shoot-third-party",
            host: keycloakHost,
            realm: "shoot-realm")
        // If you want to use embedded web view uncomment
          keycloakConfig.isWebView = true

        // Workaround issue on Keychain https://forums.developer.apple.com/message/23323
        let gdModule = KeycloakOAuth2Module(config: keycloakConfig, session: UntrustedMemoryOAuth2Session(accountId: "ACCOUNT_FOR_CLIENTID_\(keycloakConfig.clientId)"))

        // let gdModule = AccountManager.addKeycloakAccount(keycloakConfig)
        self.http.authzModule = gdModule
       /* gdModule.login { (response, token, error) in

        } */

         print("Perform photo upload with Keycloak")

       self.performUpload("\(keycloakHost)/shoot/rest/photos", parameters: self.extractImageAsMultipartParams())


    func performUpload(url: String, parameters: [String: AnyObject]?) {

        self.http.request(HttpMethod.POST, path: url, parameters: parameters, credential: nil, responseSerializer: nil) { (response, error) in
            if (error != nil) {
                self.presentAlert("Error", message: error!.localizedDescription)
            } else {
                self.presentAlert("Success", message: "Successfully uploaded!")


        self.http.POST(url, parameters: parameters, completionHandler: {(response, error) in
            if (error != nil) {
                self.presentAlert("Error", message: error!.localizedDescription)
            } else {
                self.presentAlert("Success", message: "Successfully uploaded!")


Disclaimer : This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail to IT at Indegene.com and immediately and permanently delete this message and any attachments. Any views expressed in this mail are not necessarily the views of INDEGENE. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20160428/5734a74a/attachment-0001.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Terminal Saved Output.txt
Url: http://lists.jboss.org/pipermail/aerogear-users/attachments/20160428/5734a74a/attachment-0001.txt 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20160428/5734a74a/attachment-0001.htm 

More information about the Aerogear-users mailing list