The latest service changes have not yet been reflected in this content. We will update the content as soon as possible. Please refer to the Korean version for information on the latest updates.
Available in Classic and VPC
This is a user guide for using the LINE login feature.
For more information on LINE, see LINE Developers.
iOS
Set Info.plist
- From project's TARGETS > Info > URL Types, add "line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)."
- Add "lineauth2" to the project's TARGETS > Info > Custom iOS Target Properties > "Queried URL Schemes."
The following is an example of adding directly to Info.plist.
| Key | Value |
|---|---|
| CFBundleURLSchemes | line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER) |
| LSApplicationQueriesSchemes | lineauth2 |
// Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>lineauth2</string>
</array>
Swift
Replace the code in the AppDelegate.swift method using the following code.
// AppDelegate.swift
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
}
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
let sceneConfiguration = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
sceneConfiguration.delegateClass = SceneDelegate.self
return sceneConfiguration
}
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
...
// LINE login callback
NotificationCenter.default.post(name: Notification.Name("LineLoginURL"), object: nil, userInfo: ["application": application, "url": url, "options": options, "type": "AppDelegate"])
...
return true
}
}
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else {
return
}
...
// LINE login callback
NotificationCenter.default.post(name: Notification.Name("LineLoginURL"), object: nil, userInfo: ["url": url, "type": "SceneDelegate"])
...
}
Objective-C
Replace and add the code in the AppDelegate.m method using the following code.
// AppDelegate.m
#import "AppDelegate.h"
@interface AppDelegate () <UNUserNotificationCenterDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
...
return YES;
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
...
// LINE login callback
NSDictionary *userInfo = @{@"application": app, @"url": url, @"options": options, @"type": @"AppDelegate"};
[[NSNotificationCenter defaultCenter] postNotificationName:@"LineLoginURL" object:nil userInfo:userInfo];
...
return YES;
}
Replace and add the code in the SceneDelegate.m method using the following code.
// SceneDelegate.m
#import "SceneDelegate.h"
@interface SceneDelegate ()
@end
@implementation SceneDelegate
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
NSURL *url = URLContexts.allObjects.firstObject.URL;
if (!url) return;
// LINE login callback
NSDictionary *userInfo = @{@"url": url, @"type": @"SceneDelegate"};
[[NSNotificationCenter defaultCenter] postNotificationName:@"LineLoginURL" object:nil userInfo:userInfo];
}