Quantcast

[Aerogear-users] AeroGear SDK integration with Keycloak

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Aerogear-users] AeroGear SDK integration with Keycloak

Ashish Pandita
Hi All, 

I am having some trouble using aerogear to connect keycloak locally. I am using shoot example I did the following things 
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(response)
            print(token)
            print(error)
        } */

    

        

         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 [hidden email] 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.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users

Terminal Saved Output.txt (26K) Download Attachment
ATT00001.htm (322 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] AeroGear SDK integration with Keycloak

Daniel Passos
Hi

Are you getting this error when you are firing a request to KC server from your app?

```
17:01:31,549 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: HTTP 404 Not Found
```

I'm not 100% sure (didn't have time to test) but I think the problem is, KC 1.9.1 are using different endpoints and the iOS app was not updated yet.

Our cookbook backend[1] was updated to 1.9.1 by the community[2] weeks ago

Unfortunately he updated only the Android app[3] to the new endpoints

Can you check the Android PR[3] and see if you change that in the iOS app it works?

On Thu, Apr 28, 2016 at 8:44 AM, Ashish Pandita <[hidden email]> wrote:
Hi All, 

I am having some trouble using aerogear to connect keycloak locally. I am using shoot example I did the following things 
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(response)
            print(token)
            print(error)
        } */

    

        

         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 [hidden email] 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.

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




--
-- Passos

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] AeroGear SDK integration with Keycloak

Corinne Krych
Hello Ashish,

Could you test this PR [1]?
As Passos mentioned the 404 error must be due to the endpoint changes.

++
Corinne

On 28 April 2016 at 18:01, Daniel Passos <[hidden email]> wrote:
Hi

Are you getting this error when you are firing a request to KC server from your app?

```
17:01:31,549 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: HTTP 404 Not Found
```

I'm not 100% sure (didn't have time to test) but I think the problem is, KC 1.9.1 are using different endpoints and the iOS app was not updated yet.

Our cookbook backend[1] was updated to 1.9.1 by the community[2] weeks ago

Unfortunately he updated only the Android app[3] to the new endpoints

Can you check the Android PR[3] and see if you change that in the iOS app it works?

On Thu, Apr 28, 2016 at 8:44 AM, Ashish Pandita <[hidden email]> wrote:
Hi All, 

I am having some trouble using aerogear to connect keycloak locally. I am using shoot example I did the following things 
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(response)
            print(token)
            print(error)
        } */

    

        

         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 [hidden email] 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.

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




--
-- Passos

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users



_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Aerogear-users] AeroGear SDK integration with Keycloak

Corinne Krych
Hello Ashish,

PR tested and merged.
aerogear-ios-oauth2 and Shoot app in aerogear-ios-cookbook have been updated to fir latest Keycloak release.
A new release of AeroGearOAuth2 will be announced soon. In the mean time fetch the pod from github master branch.

Let us know if you still have issues.
++
Corinne

On 29 April 2016 at 13:57, Corinne Krych <[hidden email]> wrote:
Hello Ashish,

Could you test this PR [1]?
As Passos mentioned the 404 error must be due to the endpoint changes.

++
Corinne

On 28 April 2016 at 18:01, Daniel Passos <[hidden email]> wrote:
Hi

Are you getting this error when you are firing a request to KC server from your app?

```
17:01:31,549 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: HTTP 404 Not Found
```

I'm not 100% sure (didn't have time to test) but I think the problem is, KC 1.9.1 are using different endpoints and the iOS app was not updated yet.

Our cookbook backend[1] was updated to 1.9.1 by the community[2] weeks ago

Unfortunately he updated only the Android app[3] to the new endpoints

Can you check the Android PR[3] and see if you change that in the iOS app it works?

On Thu, Apr 28, 2016 at 8:44 AM, Ashish Pandita <[hidden email]> wrote:
Hi All, 

I am having some trouble using aerogear to connect keycloak locally. I am using shoot example I did the following things 
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(response)
            print(token)
            print(error)
        } */

    

        

         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 [hidden email] 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.

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




--
-- Passos

_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users




_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Loading...