Quantcast

KeychainWrapper

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

KeychainWrapper

ashish
This post was updated on .
Can someone please guide on using keychainwrapper in AeroGearOAuth2

let token =  KeychainWrapper.objectForKey("Access token")


tried this
 let keychain = KeychainWrap()
 let token =  keychain.read("Mobile", tokenType:TokenType.AccessToken)


These docs looks old
https://aerogear.org/docs/specs/aerogear-ios-oauth2/Classes/KeychainWrap.html

Not sure which are the right keys to get correct values from keychainwrapper

Is there any example or code snippet I can refer or any docs on Keychain and aerogear


Thanks
Ashish
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: KeychainWrapper

ashish
This post was updated on .
Thanks I got it accountId can be set from client and can be any string.  It took some time to find bits and pieces but works fine.
This work but I need to set the account ID in
func keyCloakModule() ->  OAuth2Module {
   
        let keycloakConfig = Config(base: "http://kc.dev.mycompany.com:8080", authzEndpoint: "auth/realms/SharedServices/protocol/openid-connect/auth", redirectURL:"myapp:/", 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",
                                    clientSecret:"exxxxxxxxxxxxxxxxx",
                                    accountId: "Keychain_test"
           
        )
        // AeroGearOAuth2.OpenIDClaim?
        keycloakConfig.isWebView = true
   
        let http = Http()
        let gdModule = AccountManager.addAccount(keycloakConfig, moduleClass: KeycloakOAuth2Module.self)
        //  gdModule = KeycloakOAuth2Module(config: keycloakConfig, session: UntrustedMemoryOAuth2Session(accountId: "ACCOUNT_FOR_CLIENTID_\(keycloakConfig.clientId)"))
        http.authzModule = gdModule

   
        return gdModule
       
    }
 let keychain = KeychainWrap()
 let token =  keychain.read("Keychain_test", tokenType:TokenType.AccessToken)
Loading...