v2.1.1
flutter_naver_login
Android और iOS पर मूल Naver लॉगिन SDK का उपयोग करने के लिए एक Flutter प्लगइन।
77लाइक 8.6 हज़ार30-दिन डाउनलोड150Pub अंक
AndroidiOS
नेवर साइन इन के लिए एक फ्लटर प्लगइन।
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
A Flutter plugin for using the native Naver Login SDKs on Android and iOS.
Add the following to your pubspec.yaml file:
dependencies:
flutter_naver_login: ^2.1.0
android/app/src/main/res/values/strings.xml:<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="client_id">[client_id]</string>
<string name="client_secret">[client_secret]</string>
<string name="client_name">[client_name]</string>
</resources>
android/app/src/main/AndroidManifest.xml:<application
android:name="io.flutter.app.FlutterApplication"
android:label="your_app_name"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="com.naver.sdk.clientId"
android:value="@string/client_id" />
<meta-data
android:name="com.naver.sdk.clientSecret"
android:value="@string/client_secret" />
<meta-data
android:name="com.naver.sdk.clientName"
android:value="@string/client_name" />
</application>
FlutterFragmentActivity in your MainActivity:import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity()
cd ios
pod install
ios/Runner/Info.plist:<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>[UrlScheme]</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>naversearchapp</string>
<string>naversearchthirdlogin</string>
</array>
<key>NidUrlScheme</key>
<string>[UrlScheme]</string>
<key>NidClientID</key>
<string>[ConsumerKey]</string>
<key>NidClientSecret</key>
<string>[ConsumerSecret]</string>
<key>NidAppName</key>
<string>[ServiceAppName]</string>
import NidThirdPartyLogin
@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if (NidOAuth.shared.handleURL(url) == true) { // If the URL was passed from the Naver app
return true
}
// Handle URLs coming from other apps
return false
}
}
<key>naverServiceAppUrlScheme</key>
<string>[UrlScheme]</string>
<key>naverConsumerKey</key>
<string>[ConsumerKey]</string>
<key>naverConsumerSecret</key>
<string>[ConsumerSecret]</string>
<key>naverServiceAppName</key>
<string>[ServiceAppName]</string>
<key>NidUrlScheme</key>
<string>[UrlScheme]</string>
<key>NidClientID</key>
<string>[ConsumerKey]</string>
<key>NidClientSecret</key>
<string>[ConsumerSecret]</string>
<key>NidAppName</key>
<string>[ServiceAppName]</string>
import NaverThirdPartyLogin
@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
var applicationResult = false
if (!applicationResult) {
applicationResult = NaverThirdPartyLoginConnection.getSharedInstance().application(app, open: url, options: options)
}
if (!applicationResult) {
applicationResult = super.application(app, open: url, options: options)
}
return applicationResult
}
}
import NidThirdPartyLogin
@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if (NidOAuth.shared.handleURL(url) == true) { // If the URL was passed from the Naver app
return true
}
// Handle URLs coming from other apps
return false
}
}
cd ios
pod deintegrate
pod install
flutter clean
flutter pub get
class NaverLoginResult {
final NaverLoginStatus status;
final NaverAccountResult? account;
}
class NaverToken {
final String accessToken;
final String refreshToken;
final String tokenType;
final String expiresAt;
bool isValid();
}
class NaverAccountResult {
final String id;
final String nickname;
final String name;
final String email;
final String gender;
final String age;
final String birthday;
final String birthyear;
final String profileImage;
final String mobile;
final String mobileE164;
}
enum NaverLoginStatus {
loggedIn,
loggedOut,
error
}
try {
final NaverLoginResult res = await FlutterNaverLogin.logIn();
if (res.status == NaverLoginStatus.loggedIn) {
// Login successful
final account = res.account;
print('User name: ${account?.name}');
}
} catch (error) {
print('Login failed: $error');
}
try {
final NaverToken token = await FlutterNaverLogin.getCurrentAccessToken();
if (token.isValid()) {
print('Access Token: ${token.accessToken}');
print('Refresh Token: ${token.refreshToken}');
print('Token Type: ${token.tokenType}');
print('Expires At: ${token.expiresAt}');
}
} catch (error) {
print('Failed to get token: $error');
}
try {
final NaverAccountResult account = await FlutterNaverLogin.getCurrentAccount();
print('User name: ${account.name}');
print('User email: ${account.email}');
print('User profile: ${account.profileImage}');
} catch (error) {
print('Failed to get account: $error');
}
try {
final NaverLoginResult res = await FlutterNaverLogin.logOut();
if (res.status == NaverLoginStatus.loggedOut) {
// Logout successful
}
} catch (error) {
print('Logout failed: $error');
}
try {
final NaverLoginResult res = await FlutterNaverLogin.logOutAndDeleteToken();
if (res.status == NaverLoginStatus.loggedOut) {
// Logout and token deletion successful
}
} catch (error) {
print('Logout and token deletion failed: $error');
}
CocoaPods Version Error
platform :ios, '13.0' // https://github.com/naver/naveridlogin-sdk-ios-swift
Build System Error
Linker Error
cd ios
pod deintegrate
pod install
Back Button Issue
MainActivity code with shouldAutomaticallyHandleOnBackPressedProguard Issues
proguard-rules.pro fileFeel free to contribute to this project by submitting issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
निर्भरता सूची 4 आइटम
{"sdk":"flutter"}^2.0.2{"sdk":"flutter"}^5.0.0उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗