OAuth Error General Code 4 Swift - AppAuth for iOS -


im trying implement appauth in ios. basic implementation has been done. seems working fine. im not recieving token expected. im getting error error domain=org.openid.appauth.general code=-4

   let authorizationendpoint : nsurl = nsurl(string: "https://accounts.google.com/o/oauth2/v2/auth")!     let tokenendpoint : nsurl = nsurl(string: "https://www.googleapis.com/oauth2/v4/token")!      let configuration = oidserviceconfiguration(authorizationendpoint: authorizationendpoint url, tokenendpoint: tokenendpoint url)      let request  = oidauthorizationrequest.init(configuration: configuration, clientid: "<mytoken>", scopes: [oidscopeopenid], redirecturl: url(string: "http://127.0.0.1:9004")!, responsetype: oidresponsetypecode, additionalparameters: nil)      let appdelegate = uiapplication.shared.delegate as! appdelegate     //        appdelegate.currentauthorizationflow     appdelegate.currentauthorizationflow = oidauthstate.authstate(bypresenting: request, presenting: self, callback: { (authstate, error) in         if((authstate) != nil){             print("got authorization tokens. access token: \(authstate?.lasttokenresponse?.accesstoken)")         }else{             print("authorization error \(error?.localizeddescription)")         }     }) 

after dealing errors , changes figured out problem after dealing redirecturi , token. redirecturi - once authorized google generate token , after should open app. redirecturi that. how can setup redirecturi

the value ios url scheme wil scheme of redirect uri. client id in reverse domain name notation, e.g. com.googleusercontent.apps.identifier. construct redirect uri, add own path component. e.g. com.googleusercontent.apps.identifier:/oauth2redirect/google. note there single slash (/) after scheme.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -