|
I configured keycloak and iOS app I am able to connect with iOS app to keycloak. 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. 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) }
}
}
|