flutter Google SignInのexampleをやってみた

Posted by on Fri, Jun 22, 2018

はじめに

flutter で google singinをやってみた

https://github.com/flutter/plugins/tree/master/packages/google_sign_in

iOSAndroid

メモ

  • Firebaseのプロジェクトつくったりgoogle-services.jsonやplistを作ってプロジェクトに格納したりするのは、このYoutubeがわかりやすいかも

  • AndroidはSHA1のフィンガープリントを追加する必要がある

    • デバッグ用のフィンガープリントの確認方法(パスワードはandroid)
    % keytool -exportcert -list -v \-alias androiddebugkey -keystore ~/.android/debug.keystore 
    
    • SHA256も表示されるが、そっちじゃなくてSHA1の方なので注意
  • iOSはInfo.plistに下記を設定(READMEに記載あり)

    <!-- Put me in the [my_project]/ios/Runner/Info.plist file -->
    <!-- Google Sign-in Section -->
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <!-- TODO Replace this value: -->
                <!-- Copied from GoogleServices-Info.plist key REVERSED_CLIENT_ID -->
                <string>com.googleusercontent.apps.861823949799-vc35cprkp249096uujjn0vvnmcvjppkn</string>
            </array>
        </dict>
    </array>
    <!-- End of the Google Sign-in Section -->
    
  • google signinのexamplePeople APIを有効にしないと403が返ってくる

おまけ

Androidのリリースビルド方法

下記に詳細に記載されているのでAndroid知らなくてもできそう https://flutter.io/android-release/#create-a-keystore

リリースビルドするには

$ flutter build apk

--debugをつけるとデバッグビルドになる

インストールするには

$ flutter install


comments powered by Disqus