User Authentication - GluedIn
Authentication
Method Method detail
authenticateuser() Convenient getter method to initiate User Sign In and to determine whether the user is valid to authenticate or not.
registerUser() Convenient setter and getter method to initiate User Registration. It also returns User information if you want to use it for the further authentication process.
socialLogin() Convenient getter and setter to initiate User registration using Social Sign-In.
forgetPassword() Convenient getter setter to initiate Forgot Password.
changePassword() Convenient getter and setter method to initiate change password SDK method.
logout() Convenient setter to initiate User logout from the SDK.
confiq() Convenient setter to initiate User logout from the SDK.
isUserLogedin() Convenient getter method to get user login status.
getLoginType() Convenient getter method to get user login status by social.
checkUserNameSuggestion() Convenient getter method to get list of user name suggestion based on provided string or name.
deleteUserAccount() Convenient setter and getter method which will delete logged in user account permanently from system and return success/Fail as a response.
  • User Signin
    API Class : Auth
    Method : userSignIn → authenticateUser
    Convenient getter method to initiate User Sign In and to determine whether the user is valid to authenticate or not.
    Request:
    /**
         - parameter Email: Email to check for valid user , Type: String
                     Password: Password to check for valid user, Type: String
                     firebaseToken: firebase token to send notification, Type: String
                     deviceID,deviceType: use to valid for valid user device. In case of guest token it also determine as MAU
                 fullName: full name is use to automatically create user on server, Its being used on time of autocreate true condition. Mandatory field. Type: String
        autoCreate: in case of not using GluedIn authentication process please pass this value as “true” so the system knows that you are using own authentication screen and process.
         - Callback : Result with JSON format as success and failure
         */
         // Call userSignUp method on sign up action
    Auth.sharedInstance.authenticateUser(
                email: txtEmailName.text ?? "",
                password: txtPassword.text ?? "",
                firebaseToken: "Firebase Token" ?? "",
                deviceId: "Device ID",
                deviceType: "iOS/Android",
                fullName: "User Name",
                autoCreate: true,
                success: { [weak self] result in
                    guard let weakSelf = self else { return }
                    weakSelf.showAlert(withTitle: "Alert", withMessage: result ?? "")
                }, failure: { [weak self] error in
                    guard let weakSelf = self else { return }
                    weakSelf.showAlert(withTitle: "Alert", withMessage: error)
                })
    Response:
    • Response Object : UserProfile Object
    • Keys which object have::
    • accessToken “Further use inside app and other api calling”
    • description = "";
    • email “Further use inside app and other api calling”
    • fullName “Use on profile screen”
    • profileImageUrl “Further use on profile screen”
    • token = “Further use inside app and other api calling”
    • userId “Further use inside app and user activity api calling”
    • userName “Further use inside app and user activity api calling”
  • User Sign-Up
    API Class : Auth
    Method : registerUser
    Convenient setter and getter method to initiate User Registration. It also returns User information if you want to use it for further authentication process.
    Request:
    
    // Call registerUser method on sign up action
    Parameter:
    Email: Email to check for valid user , Type: String
    Password: Password to check for valid user, Type: String
    fullName: Valid user Full Name to display on profile, Type: String
    
    Auth.sharedInstance.registerUser(
        fullName: txtFullName.text ?? "",
        email: txtEmail.text ?? "",
        password: txtPassword.text ?? "",
        userName: "User Name",
        termConditionAccepted: true,
        success: { [weak self] result in
             guard let weakSelf = self else { return }
             weakSelf.showAlert(withTitle: "Alert", withMessage: result ?? "")
         }, failure: { [weak self] error in
             guard let weakSelf = self else { return }
             weakSelf.showAlert(withTitle: "Alert", withMessage: error)
        })
    Response:
    • Response Object : UserProfile Object
    • Keys which object have::
    • statusCode “Further use inside app and other api calling”
    • Message “Further use inside app and other api calling”
    • Success “Further use inside app and other api calling”
  • Social Sign-up
    API Class : Auth
    Method : socialLogin
    Convenient getter and setter to initiate User registration using Social Sign-In.
    Request:
    
    // Call userSignUp method on sign up action
    
    param: valid sign in param which return from the social app during their sign sign in process , Type: String
    let socialSiginParam = SocialSiginParam(email:”Email id”,
      fullName: "Full Name",
      userId: "User Id",
      userName: "User Name",
      profileImageUrl: " Profile Image",
      type: “Type of Social”,
      socialType: “Social Type”,
      token: “Social Token”,
      termConditionAccepted: true)
    Auth.sharedInstance.socialLogin(param: socialSiginParam, success: { [weak self] result in
                guard let weakSelf = self else { return }
      }, failure: { [weak self] error in
       guard let weakSelf = self else { return }
    })
    Response:
    • Response Object : UserProfile Object
    • accessToken “Further use inside app and other api calling”
    • description = "";
    • email “Further use inside app and other api calling”
    • fullName “Use on profile screen”
    • profileImageUrl “Further use on profile screen”
    • token “Further use inside app and other api calling”
    • userId “Further use inside app and user activity api calling”
    • userName “Further use inside app and user activity api calling”
  • Forget Password
    API Class : Auth
    Method : forgetPassword
    Convenient getter setter to initiate Forgot Password
    Request:
    
    /**
         - parameter Email: Email to check for valid user , Type: String
     */
     // Call forget method inside the forget action
    Auth.sharedInstance.forgetPassword(withEmail: email, completion: { [weak self] status, message in
      guard let weakSelf = self else { return }
      weakSelf.isSuccess = status
      print( message)
    })
    Response:
    • Status : True/False
    • msg: “Success/Failure Message”
  • Change Password
    API Class : Auth
    Method : changePassowrd
    Convenient getter and setter method to initiate change password SDK method
    Request:
    
    /* /// Method For change Password
        /// - Parameters:
        ///   - oldpassword: Param type string
        ///   - newPassword: Param type string
        ///   - success: Respose after success
        ///   - failure: Respose after failure
        /// - Returns: Return type void()
    */    
        // Call change password method inside the change password action
    Auth.sharedInstance.changePassword(
          oldpassword: “old Password”,
          newPassword: “newPassword”) { [weak self] result in
          guard let weakSelf = self else { return }
          weakSelf.changePasswordObject = result
          } failure: { [weak self] error in
          guard let weakSelf = self else { return }
          }
    Response:
    • Status : True/False
    • msg: “Success/Failure Message”
  • User Logout
    API Class : Auth
    Method : logout
    Convenient setter to initiate User logout from the SDK.
    Request:
    
    // Call logout method on logout action
    Auth.sharedInstance.logout(completion: { [weak self] status, msg in
                guard let weakSelf = self else { return }
                if status ?? false {
                    UserDefaults.standard.set(false, forKey: "isLogin")
                    weakSelf.sdkInit()
                } else {
                    //weakSelf.showAlert(withTitle: "Alert", withMessage: msg ?? "")
                   print(msg)
                }
            })
    Response:
    • "message": "User logout success", → User logout success or failur message
    • "message": "status": True/False → User logout status True or False
  • Get Configuration Method
    API Class : Auth
    Method : config
    Convenient setter to initiate User logout from the SDK.
    Request:
    
    Auth.sharedInstance.config { 
       [weak self] response in guard let weakSelf = self else { return }
         // response.data
     } failure: { [weak self] error in
       guard let weakSelf = self else { return }
    }
    Response:
    • "message":Ads - Ads setting for the app to integrate inside the app
    • "message":download: Download option to add if admin allow to add the download option on feed
    • "message":share: Share option to add if admin allow to add the share option on the share feed
  • Check if User login or not method
    API Class : Auth
    Method : isUserLoggedIn
    Convenient getter method to get user login status.
    Request:
    
    /*
    Bool Return to check user login status 
    */
    return Account.sharedInstance.isUserLoggedIn()
    Response:
    • Bool:True/False
  • Check if User login Type (From social or from other medium)
    API Class : Auth
    Method : getLoginType
    Convenient getter method to get user login status by social.
    Request:
    
    /*
    Bool Return to check user login status 
    */
    return Account.sharedInstance.isSocialLogin()
    Response:
    • "Bool":True/False
  • Get/Check User Name suggestion
    API Class : Auth
    Method : getUserNameSuggestion
    Convenient getter method to get list of user name suggestion based on provided string or name.
    Request:
    
    /*
    Will return Suggested username list 
    */
    /// Method for get Suggested user name based on email id
        /// - Parameters:
        ///   - email: Param type string
        ///   - success: Respose after success
        ///   - failure: Respose after any failure with error
    Auth.sharedInstance.getUserNameSuggestion(email: "User Email id") { [weak self] result in
                    guard let weakSelf = self else { return }
                    // success(result)
                } failure: { [weak self] error, code in
                    guard let weakSelf = self else { return }
                    //failure(error,code)
                }()
    Response:
    • User name suggestion list
  • Delete User Account method
    API Class : Auth
    Method : deleteUserAccount
    Convenient setter and getter method which will delete logged in user account permanently from system and return success/Fail as a response.
    Request:
    
    /// Method for delete loggedin user
    /// - Parameters: No Parameter required, Automaticaly consider loggedin user based on Auth token
    Auth.sharedInstance.deleteUserAccount { [weak self] result in
                    guard let weakSelf = self else { return }
                   // Success Handle
                } failure: { [weak self] error, code in
                    guard let weakSelf = self else { return }
                    // Fail handle
                }
    Response:
    • Success/Fail