How can one-click login be implemented on the iOS side? This article teaches you!

Keywords: iOS SDK Mobile

Before the emergence of one-click login, the most common ways of APP registration and login in the market are account password, SMS authentication and third-party login. These methods seem to be common and convenient, but in fact, there are many security risks, and the user experience is relatively poor. Firstly, the arrival rate of SMS authentication code is low, the user's operation is tedious and the waiting time is long. If there is a bug, APP will face the disastrous situation of being uninstalled. Furthermore, the Trojan Horse of short message and the pseudo base station make the authentication code more insecure and greatly reduce the user's experience.

And "one-click login" can allow users to use local number to login / register APP, mobile phone number is user account, without password and short message verification, operator gateway directly verifies mobile phone local number, which can easily solve the above problems. So, how can such a useful function be realized? Today I will introduce Aurora Developer Service Product Aurora Certification.

Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Aurora Au The steps of SDK integration on iOS side are as follows:

1. Register the Aurora Developer Account and authenticate the developer. If you have used Aurora Push before, this step can be omitted directly. If other SDK s that did not use Aurora before are required to register their accounts, the portal: https://www.jiguang.cn/identify.

2. Select the application to open Aurora Authentication. In the application settings, click the "Aurora Authentication" button on the left. Fill in the application introduction [Application Classification], [Application Introduction]. iOS applications need to fill in [Bundle ID] and click on [Submit Audit] after completion.

3. If you need to use one-click login function, after step 2 is completed, please select the platform to open one-click login, fill in the RSA encryption public key, and click the "Submit Audit" button.

4. After submitting, we need to wait for the audit. The audit is still very fast. It passed in about half an hour. For the first time, Aurora will give more than 10,000 test items, which can be called conscience. After the audit, download the SDK and refer to the following steps to integrate the JVerification SDK. Portal: https://docs.jiguang.cn//jver...

Manual integration steps
1. Please import and download libs folder in SDK package in your own project

2. To add the corresponding Frameworks to the project, the Frameworks that need to be added to the project are as follows:

  • AdSupport.framework (get IDFA needs; if you don't use IDFA, don't add it)
  • CoreLocation.framework
  • CFNetwork.framework
  • CoreFoundation.framework
  • libresolv.tbd
  • libz.tbd
  • libc++.1.tbd
  • CoreTelephony.framework
  • SystemConfiguration.framework
  • Security.framework
  • CoreGraphics.framework
  • libsqlite3.tbd
  • MobileCoreServices.framework
  • Location: General linked Frameworks and libraries

3. Configuration - ObjC
Setting Project TARGETS - > Build Settings - > Other Links Flags, Setting - ObjC

4. Configuration supports Http transmission
Right-click to open the project plist file and add the following code

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

5. Drag JVerificationResource.bundle from Demo to your project directory.
Reference Step 1

6. Add one-click login function to the project

  • Configure bundleID under General identity (see figure below)

  • Add the following code to the relevant class that references the JVERIFICATIONService.h header file (see figure below)
    //Introduction of JVERIFICATIONService.h header file
    #import "JVERIFICATIONService.h"
    // Header files to be introduced if idfa functionality is required (optional)
    #import <AdSupport/AdSupport.h>
  • The application of JVerification SDK must initialize JVERIFICATION Service first, otherwise it will not work properly. Please add the following code to the appropriate location (see figure below).

      //To use IDFA, add this code and set advertisingId in the initialization configuration class
       NSString *idfaStr = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
       JVAuthConfig *config = [[JVAuthConfig alloc] init];
       config.appKey = @"your appkey";
       config.advertisingId = idfaStr;
       [JVERIFICATIONService setupWithConfig:config];   
    

  • Operation engineering

The log prints the registration result and the login result, and returns the corresponding UID and registration ID to indicate the integration success (refer to the following log)

2019-08-09 11:10:32.727188+0800 login[1240:285949]  | JIGUANG | I - [JIGUANGService] 
--------------------------- JVerification Log ----------------------------
--------------------JVerification SDK Version:2.4.0--build:102------------
--------------------JCore Lib Version:2.1.1--build:78-----------------
-----------------AppKey:79d4c5ad142bba180ac12344-----------------------
-----------------------------------------------------------------------
2019-08-09 11:10:32.823700+0800 login[1240:285952]  | JIGUANG | I - [JIGUANGClientController] Action - setup
2019-08-09 11:10:32.847702+0800 login[1240:285949]  | JIGUANG | I - [JIGUANGConnectManager] Action - closeConection
2019-08-09 11:10:32.965061+0800 login[1240:285949]  | JIGUANG | I - [JIGUANGRegister] 
----- register info -----
Appkey: 79d4c5ad142bba180ac18d2b
token:  
 advertisingIdentifier: E409D462-ED53-4901-8CB1-73807F60AA11
2019-08-09 11:10:34.058410+0800 login[1240:285949]  | JIGUANG | I - [JIGUANGTcpEventController] 
----- register result -----
uid: 29023815771
registrationID:13165ffa4e7673d8bd8
2019-08-09 11:10:34.066755+0800 login[1240:285928] Initialization results result:{
    code = 8000;
    content = "init success";
}
2019-08-09 11:10:34.107601+0800 login[1240:285949]  | JIGUANG | I - [JIGUANGTcpEventController] 
----- login result -----
uid:29023815771 
registrationID:13165ffa4e7673d8bd8 
2019-08-09 11:10:34.132452+0800 login[1240:285949]  | JIGUANG | I - [JIGUANGIDFAReport] upload advertisingIdentifier  E409D462-ED53-4901-8CB1-73807F60AA11
2019-08-09 11:10:35.080778+0800 login[1240:285950]  | JIGUANG | I - [JIGUANGTcpEventController] upload advertisingIdentifier  success
2019-08-09 11:10:36.113310+0800 login[1240:285950]  | JIGUANG | I - [JIGUANGConnectManager] Action - disConnect
2019-08-09 11:10:36.113575+0800 login[1240:285950]  | JIGUANG | I - [JIGUANGConnectManager] Action - closeConection
  • After successful integration, you can experience one-click login by clicking on the interface corresponding to the button above (acquiring tonken, requesting authorization, prefetch number, login).
  • If you don't like the default login page, Aurora Aurora Authentication SDK provides a custom page interface, you can modify the UI document reference according to your own design:

https://docs.jiguang.cn/jveri...

These are the integration steps of iOS one-click login SDK. It's really convenient to implement! Developers who want to improve user experience and product safety may wish to refer to it.

Posted by diegueins on Fri, 27 Sep 2019 04:06:12 -0700