Monday, June 17, 2024
HomeiOS Developmentios - Cognito Authenticator view hangs in Swift

ios – Cognito Authenticator view hangs in Swift


I’ve arrange authentication in Cognito and the hosted UI works as anticipated, for each e-mail/password and SIWA (Signal In With Apple). I’m now making an attempt to combine this with my Swift (iOS 17) mission. In my app, I’ve outlined init() which has:

        // Configure Amplify
        do {
            attempt Amplify.add(plugin: AWSCognitoAuthPlugin())
            Amplify.Logging.logLevel = .verbose
            attempt Amplify.configure()
            print("Efficiently configured Amplify")
        } catch {
            print("An error occurred establishing Amplify: (error)")
        }

This works accurately, printing that the Amplify was efficiently configured. Then I outlined a brand new view, as follows:

import SwiftUI
import Authenticator

struct CognitoAuthView: View {
    var physique: some View {
        Authenticator { state in
                        VStack {
                            Textual content("Howdy, (state.consumer.username)")
                            Button("Signal out") {
                                Job {
                                    await state.signOut()
                                }
                            }
                        }
                    }
    }
}

There are two points with this view. First, it doesn’t present the SIWA button in SwiftUI. Second, once I enter the e-mail/password credentials and press Login, it appears to hold, with the next messages (no error is thrown):

Making an attempt to Signal In
Beginning execution for Auth.signInAPI
Beginning execution
Examine if authstate configured
Auth state configured
Validating present state

Can somebody please assist me perceive why that is hanging and the way I can repair this? Any recommendation is appreciated.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments