前提・実現したいこと
AWS CognitoでiOS appのSign up/Sign in機能を実現しようとしています。
基本的にAWS AmplifyのSDK DOCsを頼りに開発を進めています。
基本的なSign up/Sign in機能は実現出来ましたが、
一つの目的である、Sign up時に、userが自分でグループを選び、
グループごとに、違うアクセス権限が与えられているため、user一人ひとりのアクセス権限(ID pool)を細かく管理したい
という機能を実現したいです。
簡単に言いますと、userのSignUpと同時に異なるID poolに分類したいです。
問題
どのようなfunctionを利用すれば、userを異なるID poolに分類できますか?
似たような機能のサンプルももしあれば、ご教示頂きたいです。
該当のソースコード
SDK DOCsが提示している方法でSignIn/SignUpを実現しています。
完全に一致では無いですが、この様な感じです。
swift
1AWSMobileClient.sharedInstance().signUp(username: "your_username", 2 password: "Abc@123!", 3 userAttributes: ["email":"john@doe.com", "phone_number": "+1973123456"]) { (signUpResult, error) in 4 if let signUpResult = signUpResult { 5 switch(signUpResult.signUpConfirmationState) { 6 case .confirmed: 7 print("User is signed up and confirmed.") 8 case .unconfirmed: 9 print("User is not confirmed and needs verification via (signUpResult.codeDeliveryDetails!.deliveryMedium) sent at (signUpResult.codeDeliveryDetails!.destination!)") 10 case .unknown: 11 print("Unexpected case") 12 } 13 } else if let error = error { 14 if let error = error as? AWSMobileClientError { 15 switch(error) { 16 case .usernameExists(let message): 17 print(message) 18 default: 19 break 20 } 21 } 22 print("(error.localizedDescription)") 23 } 24}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。