Not able to receive OpenIDClaim and accesstoken from redirecturi in iOS app

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

Not able to receive OpenIDClaim and accesstoken from redirecturi in iOS app

ashish
This post was updated on .
I configured keycloak and iOS app I am able to connect with iOS app to keycloak. (Oauth2.0 aerogear SDK and keycloak 1.9.3)
After successful login safari browser redirects to app where I should be able to get access token.
response comes as nil in login call back method.  I put a break and in gdModule.login jumper goes into error block  if (error != nil) {
                completionHandler(nil, nil, error)
                return
            }

Here is the error output

▿ Optional<NSError>
  - Some : Error Domain=AGAuthzErrorDomain Code=0 "(null)" UserInfo={NSLocalizedDescriptionKey=User cancelled authorization.}



Below is the code which I run
let keycloakConfig = Config(base: "http://kc.dev.com:8080", authzEndpoint: "auth/realms/SharedServices/protocol/openid-connect/auth", redirectURL:"fcapp:/", accessTokenEndpoint: "/auth/realms/SharedServices/protocol/openid-connect/token", clientId: "Mobile",
refreshTokenEndpoint: "/auth/realms/SharedServices/protocol/openid-connect/token/refresh",
revokeTokenEndpoint: "/auth/realms/SharedServices/protocol/openid-connect/token/revoke"
)
keycloakConfig.isWebView = false
let http = Http()
var gdModule = AccountManager.addAccount(keycloakConfig, moduleClass: KeycloakOAuth2Module.self)
// gdModule = KeycloakOAuth2Module(config: keycloakConfig, session: UntrustedMemoryOAuth2Session(accountId: "ACCOUNT_FOR_CLIENTID_(keycloakConfig.clientId)"))
http.authzModule = gdModule
gdModule.login {(accessToken: AnyObject?, claims: OpenIDClaim?, error: NSError?) in
print(accessToken) // Comes nil how can I get access token??
print(claims?.description) // Comes nil
print(error) // comes as errorcode =0
self.userInfo = claims
if let userInfo = claims {
if let name = userInfo.name
{ print(name) }
}
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to receive OpenIDClaim and accesstoken from redirecturi in iOS app

ashish
Loading...