Flutter App Setup to use Okto SDK
Okto Flutter SDK relies on google sign in to authenticate users. To use the Okto Flutter SDK in your flutter app, you need to set up google sign in for your flutter project.
Create Web, Android and iOS Client IDs on your Google Cloud Project.
- Follow this guide to create all the client ids.
Android Setup
- After creating the Android & Web Client ID
- Copy the Web Client ID.
- Create a file
strings.xml
inandroid/app/src/main/res/values/
folder, if its not already present. - Add the following code to
strings.xml
file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="default_web_client_id">PASTE_YOUR_WEB_CLIENT_ID_HERE</string>
</resources>
- And We are good to go for android.
iOS Setup
- After creating the iOS Client ID
- Download plist file from Google Cloud for iOS.
- Rename it to GoogleService-Info.plist
- Paste it inside ios/Runner directory.
- Copy your Client ID and iOS URL scheme from Google Cloud
- Open your info.plist file, present inside ios/Runner, and add the following code.
<key>GIDClientID</key>
<string>PASTE_YOUR_IOS_CLIENT_ID_HERE</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>PASTE_YOUR_IOS_URL_SCHEME_HERE</string>
</array>
</dict>
</array>
- Run
flutter build ios
in your terminal. - And We are good to go for iOS.