/flutter_ok_auth

Primary LanguageSwiftOtherNOASSERTION

flutter_ok_sdk

SDK for odnoklassniki

This plugin is based on:

Installation

First, add flutter_vk_sdk as a dependency in your pubspec.yaml file.

flutter_ok_sdk: ^0.0.1

Android

In your android res/values create strings.xml and fill with this examples

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="ok_sdk_app_id" translatable="false">YOUR_APP_ID</string>
    <string name="ok_sdk_app_key" translatable="false">YOUR_APP_SECRET</string>
    <string name="ok_redirect_url" translatable="false">okYOUR_APP_ID://authorize</string>
</resources>

In your AndroidManifest.xml add an activity

        <activity
                android:name="ru.ok.android.sdk.OkAuthActivity"
                android:theme="@style/LaunchTheme">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                        android:host="ok{YOUR_APP_ID}"
                        android:scheme="okauth" />
            </intent-filter>
        </activity>

iOS

In info.plist add values

<key>OkAppId</key>
<string>YOUR_APP_ID</string>

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>okYOUR_APP_ID</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>okYOUR_APP_ID</string>
        </array>
    </dict>
</array>

In your AppDelegate add or append implementation for open url

import flutter_ok_sdk

override func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    OKLogin.processOpen(url)
    return true
}