Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.
Gen1 DocsLegacy

Page updated Mar 26, 2026

Authenticator の使用

フロントエンドアプリケーションで Amplify Auth を始める最も簡単な方法は、カスタマイズ可能な UI と完全な認証フローを提供する Authenticator コンポーネント です。

import Amplify
import Authenticator
import AWSCognitoAuthPlugin
import SwiftUI
@main
struct MyApp: App {
init() {
do {
try Amplify.add(plugin: AWSCognitoAuthPlugin())
try Amplify.configure(with: .amplifyOutputs)
} catch {
print("Unable to configure Amplify \(error)")
}
}
var body: some Scene {
WindowGroup {
Authenticator { state in
VStack {
Text("Hello, \(state.user.username)")
Button("Sign out") {
Task {
await state.signOut()
}
}
}
}
}
}
}

Authenticator コンポーネントは、バックエンドから生成された出力に基づいて自動的に設定されます。Authenticator の詳細とその外観をカスタマイズする方法について詳しくは、Amplify UI ドキュメント を参照してください。