Originaly by spChief
Flutter plugin for authorization with Yandex LoginSDK for iOS and Android
- add flutter_login_yandex to your pubspec.yaml file
- Register Yandex OAuth application, see official docs
- Setup android
- Setup ios
- iOS: 3.0.1
- Android: 2.5.1
- IOS 12.0
- ANDROID minSdkVersion 21
Add to your android/app/build.gradle default section this with replacement of yourClientId to Yandex OAuth app client id:
manifestPlaceholders += [YANDEX_CLIENT_ID:"yourClientId"]
It must looks like this:
defaultConfig {
applicationId "com.example.flutter_login_yandex_example"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
manifestPlaceholders += [YANDEX_CLIENT_ID:"yourClientId"]
}
Add this to your app Info.plist and replace "yourCientId" with Yandex client id from OAuth application
<key>LSApplicationQueriesSchemes</key>
<array>
<string>primaryyandexloginsdk</string>
<string>secondaryyandexloginsdk</string>
</array>
<key>YAClientId</key>
<string>yourClientId</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>YandexLoginSDK</string>
<key>CFBundleURLSchemes</key>
<array>
<string>yxyourClientId</string>
</array>
</dict>
</array>
Also you need to set up Entitlements, add Capability: Associated Domains and enter domain with replaced yourClientId to your value:
applinks:yxyourClientId.oauth.yandex.ru
final flutterLoginYandexPlugin = FlutterLoginYandex();
final response = await _flutterLoginYandexPlugin.signIn();
saveToken(response['token'] as String);