قالب وردپرس درنا توس
Home / IOS Development / ios – Can I login with user pool and cognito identity without entering the approval delegate?

ios – Can I login with user pool and cognito identity without entering the approval delegate?



I would like to provide federal identity login, using facebook, google and user pool (email). I have a problem getting an identity after the cognito user pool is registered, successful. The error is "Authentication delegate not set".
I do not want to put the delegate to the user pool. I managed to register without having to, and I just want to get the identity.

Can this be done by setting the delegate? Am I doing something wrong?

  func setupAWS () {
loginProvider = LoginProvider ()
userPoolConfig ()
credentialsProvider = AWSCognitoCredentialsProvider (regionType: .USEast1, identityPoolId: "identityPoolId", identityProviderManager: userPool)
leave configuration = AWSServiceConfiguration (region: .USEast1
, credentialsProvider: credentialProvider) AWSServiceManager.default (). DefaultServiceConfiguration = configuration } func userPoolConfig () { leave configuration = AWSServiceConfiguration (region: .USEast1, credentialsProvider: credentialProvider) la userPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration (clientId: "clientid", clientSecret: "clientsecret", poolId: "poolid") AWSCognitoIdentityUserPool.register (with: configuration, userPoolConfiguration: userPoolConfiguration, forKey: "UserPool") userPool = AWSCognitoIdentityUserPool (forKey: "UserPool") } // logs from LoginProvider func logins () -> AWSTask { switch type { case .facebook: if let the token = accesstoken.current? .authenticationToken { return AWSTask (result: [AWSIdentityProviderFacebook:token]) } return AWSTask (error: NSError (domain: "Facebook Login", code: -1, userInfo: ["Facebook" : "No current Facebook access token"])) default: return userService.userPool! .logins () } } // After registration func verificationCodeProvided (code: string) { Presenter! .user! .confirmSignUp (code) .continueWith (block: {(answer) -> Which? whose response.error! = null { // fail } other { print ("successful") print ("Id: (self.presenter? .userService.credentialsProvider? .identityId)") // returns null self.presenter! .setUser () } return null }) } // Trying to get ID ID func setUser () { self.userService.credentialsProvider! .getIdentityId (). Continue with (block: {(task) -> any one? if (task.error! = null) { print ("Error:" + task.error! .ocalizedDescription) // prints "Authentication delegate not specified" for user pool login } otherwise { la cognitoId = task.result! print ("Cognito id: (cognitoId)") // Works for Facebook } return null }) }


Source link