Authentication - GluedIn
Authentication
This section provides detailed instructions on how to authenticate user into GluedIn SDK from your application. It includes methods for GluedIn core and launch method which is necessary for silent login.
We have 2 ways to authenticate the app into the SDK:
  • Silent authentication
  • Authentication with the Auth module (Which include the complete UX/UI screens)
Silent Authentication
Below are the steps for silent authentication in the system:
Step1: Pass user information with launch SDK as describe below:

func launchGluedAsRegisteredUser() {
  val callback: GluedInSDKCallBack = object : GluedInSDKCallBack {
            override fun onSdkInitSuccess(
                isSuccess: Boolean,
                gluedInSdkException: GluedInSdkException?
            ) = Unit
            override fun onSdkLogout() = Unit
            override fun onUserProfileClick(userId: String) = Unit
            override fun onAppAuthSuccess(
                isSuccess: Boolean,
                gluedInSdkException: GluedInSdkException?
            ) = Unit
            override fun onGluedInShareAction(shareData: ShareData) = Unit
            override fun onLoginRegistrationRequired(
                currentVideo: VideoInfo?,
                isLoginAction: Boolean
            ) = Unit
            override fun onProductCTAClicked(assetId: String, eventRefId: Int) = Unit
            override fun onSdkExit() = Unit
        }
        val gluedInConfigurations = GluedInInitializer.Configurations.Builder()
            .setSdkCallback(callback)
            .setApiKey("put_your_api_key")
            .setSecretKey("put_your_secret_key")
            .setFeedType(GluedInInitializer.Configurations.FeedType.VERTICAL) // GluedInInitializer.Configurations.FeedType.SQUARE
            .setUserInfoForAutoSignIn(UserInfoAutoSignIn("email_id", "password", "full_name", "profile_picture"))
            .create()
        gluedInConfigurations.validateAndLaunchGluedInSDK(
            this,
            GluedInConstants.LaunchType.APP,
            intent
      )  
}
  • email: Email of the user to be registered or logged in.
  • password: Password for the user.
  • fullName: Full name of the user.
  • profile picture: Url of the user profile picture.
Authentication with the Auth module
Below are the steps for authenticate app using the auth module:
Step 1: Download and add the necessary files: download the necessary file with the link “https://dg824galpjzhq.cloudfront.net/iOS/Documents/iOS/Documents/iOSCode/Authentication.zip“ and add them in to your project directory.
Step 2: Design and Create the UX/UI classes: Design and Create the UX/UI classes as per your requirement for the help we have given sample file in the downloaded folder (Link are provided above)
Step 3: call the API public method with required parameter: Below are the listed api public method which is available in GluedIn Core SDK for different purpose.
Sign-In
As a developer, For Sign-In and Sign-up you need to call below open public method in order to authenticate in the system
As a developer, For Sign-In and Sign-up you need to call below open public method in order to authenticate in the system
Login:

public fun authenticateUser(request: SignInReq)

SignInReq:
      Email : String, //User email address
      Password : String, //User password
      DeviceId : String, //Android unique id
      DeviceType : String, //Android
      firebaseToken: String, //optional(fcm token)
      metaKeys: String, 
In Success: This method will return the user data model in the success response which as a developer you need to handle and write the business logic accordingly.
In Failure: This method will return the error code error message which as a developer you need to handle according to your requirement
Other method will help user in authentication module:

// Register User:
// As a developer, For registering new user you need to call below open public method in order to register new user in the system

public fun registerUser(request: SignUpRequest) 

SignUpRequest: 
  password: String,
  email: String,
  fullName: String,
  deviceId: String,
  deviceType: String,
  termConditionAccepted: Boolean,
  userName: String,
  metaKeys: String = "",

// As a developer, you need to check the success message string, and shows message to the user according to the response which you are getting in success message.
// In Failure: This method will return the error code error message which as a developer you need to handle according to your requirement
// After Register you need to call the authenticate method to login user inside the system.



// Forget Password:
// As a developer, you should give an option to the user to renew his/her password if he/she forget his/her password. as a developer you should call the below method and pass the email id in below mention method.

public fun forgotPassword(withEmail email: String)

 

// Change Password:
// As a developer, you should give an option to the user to change the password.

public func changePassword(request: ChangePasswordReqDto)


// Logout:
// As a developer, you should give option to the user if he/she wanted to logout user from the system.

public func logout() 

 

// Get User Name Suggestion:
// This method will give couple of user name suggestion which will help to choose new unique user for the login..

public func checkUserNameAvailability()  



// Delete user from the system:
// This method will empower developer if he wanted to facilitate his user to delete his own account.

public func deleteUserAccount() 
Authentication with the Social module
Below are the steps for authenticate app using the auth module:
Step 1: Design and add the FB/Google or Apple button on controller:
Design and add FB/Google/Apple button on any of your controller from where you wanted to authenticate user by social login. For facebook/Google and apple we have provide documentation link for your help please go through in these document and follow the steps as mention:
Step 2: call the API public method with required parameter:
Below are the api public method which you need to call after successfully login with social and pass the required parameter as describe below.
Social Login:
If user trying to login in the system using social login (Google/Facebook and Apple) then as a developer you should use below method:

public func socialLogin(request: SocialLogInReq)

SocialLogInReq:
  email: String,
  fullName: String,
  userId: String,
  userName: String,
  profileImageUrl: String,
  deviceId: String,
  deviceType: String,
  type: String,
  socialType: String,
  termConditionAccepted: Boolean,
  metaKeys: String = ""