Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#100 use social logins #139

Merged
merged 44 commits into from
Aug 15, 2023
Merged

#100 use social logins #139

merged 44 commits into from
Aug 15, 2023

Conversation

haterain0203
Copy link
Collaborator

@haterain0203 haterain0203 commented Aug 13, 2023

Issue

close #100

説明

  • FlutterFire の公式ドキュメントに従い、複数のソーシャルログイン (Google, LINE, Apple) をリンクできるようにする。
  • 初めて何かしらでログインした場合
    • userSocialLogins というコレクションに、ユーザー ID と一致するドキュメントを作成
    • = はじめてのログインが済んだ時点で、下記いずれか 1 つのフィールドが true になったドキュメントが作成される
    • 以下をプロパティとして持つ、UserSocialLoginというフィールドを定義
      • isGoogleEnabled
      • isLINEEnabled
      • isAppleEnabled
  • 何しからでログイン済みの場合
    • 各種ソーシャルログインと連携または解除できる
    • その際、作成済みのUserSocialLoginのうち、該当するソーシャルログインのプロパティをtrue/falseに更新する

まだ対応できておらず、現在も対応中の事項

  • LINEのリンクおよび解除処理
  • 各ソーシャルのログインダイアログ表示時にキャンセルした場合のエラーハンドリング(現状では、キャンセルした場合に発生するExceptionをハンドリングできていない)
  • 解除処理について、「transaction で該当 userSocialLogin ドキュメントを read して ON かつ、それが唯一のソーシャルログインでなければ解除する」にできておらず、唯一のソーシャルログインでもリンクが解除される仕様になってしまっている。

UI

開発用のページを追加

その他

チェックリスト

  • PR の冒頭に関連する Issue 番号を記載しましたか?
  • 本 PR の変更に関して、エディタや IDE で意図しない警告は増えていませんか?(lint 警告やタイポなど)
  • Issue の完了の定義は満たせていますか?
  • 当該 Issue のスレッドで、レビュワーにレビュー依頼をしましたか?

…r-app into #100_use_social_logins

# Conflicts:
#	packages/firebase_common/lib/src/firestore_documents/_export.dart
#	packages/firebase_common/lib/src/firestore_documents/user_social_login.dart
#	packages/firebase_common/lib/src/firestore_documents/user_social_login.flutterfire_gen.dart
#	packages/mottai_flutter_app/lib/auth/auth.dart
#	packages/mottai_flutter_app/lib/auth/ui/auth_controller.dart
#	packages/mottai_flutter_app/lib/router/router.gr.dart
Comment on lines +12 to +15
/// [UserSocialLogin] を作成する。
///
/// ログイン済みのソーシャルログインにかかるプロパティのみ `true` とし、それ以外は `false` で作成する。
/// 既に [UserSocialLogin] が存在する状態で本処理を実行すると、意図せずにプロパティの値が `false` になるため注意。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍

Comment on lines 118 to 121
Future<void> updateUserSocialLogin({
required SignInMethod signInMethod,
required String userId,
required bool shouldLink,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これでも全然良いですが、この shoudLink については linkunlink のメソッドを分けのも良さそうだと思いました!

ユーザーは、コントローラーを通じて「リンクしたい」or「リンク解除したい」の操作を選択する方が自然かなと思うためです!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

607b2cf

07e3f63

にて修正してみたのですが、こういったイメージですかね!?

@gitguardian
Copy link

gitguardian bot commented Aug 14, 2023

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
2833900 Google API Key 4b5d64b packages/mottai_flutter_app/ios/dev/GoogleService-Info.plist View secret
2778948 Google API Key 4b5d64b packages/mottai_flutter_app/ios/prod/GoogleService-Info.plist View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@haterain0203
Copy link
Collaborator Author

#139 (comment)

これが表示されたのですが、対応方法がよくわかっておらず。。。
何かしら対応が必要でしょうか?

Comment on lines +137 to +140
await _createWorkerAndUserSocialLoginWhenFirstSignIn(
userCredential: userCredential,
signInMethod: SignInMethod.line,
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LINEでサインインした際に、
_createWorkerAndUserSocialLoginWhenFirstSignIn()
の呼び出しが漏れていたので追加しました。

@haterain0203 haterain0203 changed the title [WIP] #100 use social logins #100 use social logins Aug 15, 2023
@haterain0203
Copy link
Collaborator Author

  • 本PRで追加したTODO
  • 本PRの冒頭に記載の「まだ対応できておらず、現在も対応中の事項」
    の対応は別issueにすることとなった。
    追ってissue作成予定

@haterain0203 haterain0203 merged commit b02c79f into main Aug 15, 2023
5 checks passed
@haterain0203 haterain0203 deleted the #100_use_social_logins branch August 15, 2023 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

複数のソーシャルログインを link できるようにする
2 participants