User Identification

Anonymous Users

When you properly initialized SDK within your own Application, on first start, UUID is being generated and JWT token retrieved for “anonymous client”.

Such a token is required to sign all the events that are being passed to Synerise, but in itself has no special permissions to do something more, in fact it’s limited to the following:

  • Tracking events
  • User registration
  • User sign-in
  • User password reset
  • Authentication by Facebook
  • Authentication by OAuth

This is just the minimum to use the basic features of SDK.

User in this scenario is fully anonymous within the system and does not contain any personal information.


Recognized Users

In case you want to operate without full authentication but still have personal information you can do it without authentication as well. You may have already imported client data into Synerise and you have personal information in the system, but just need to link mobile related events with those people.

In such cases you can simply just add either customId or email to all the events and allow our backend systems to properly link events with corresponding persons.

You can do it via passing customId:

Method name: Tracker.setCustomIdentifier(customIdentifier)

Swift:

private void setCustomIdentifier(String customIdentifier) {
    Tracker.setCustomIdentifier(customIdentifier);
}

or via passing email:

Method name: Tracker.setCustomEmail(customEmail)

Swift:

private void setCustomEmail(String customEmail) {
    Tracker.setCustomEmail(customEmail);
}
Note: Please remember this is still anonymous user per our JWT token philosophy and will not have access to features other than the ones mentioned in Anonymous Users section above.

Authenticated Users

Synerise offers also means to fully authenticate Users and have full User session with JWT token that has access to all the features provided by Synerise. Today we support three different ways to authenticate User as described below.


Registration as a Service

Registration as a Service (RaaS) is a set of methods that enable you to implement full User Management in your Application without any need for third party systems. So let’s take a look how to implement these in sections below:

Register new User

In case you want to use our RaaS (Registration as a Service) you can simply implement method Client.signUp() This method provides you option to pass all of User Information along with any agreements, attributes at once.

Please note that primary identifier (unique) in use is: e-mail

Depending on backend configuration at Synerise registration may or may not require email confirmations. Today we support following registration behaviours:

  1. Automatic: account is ready to use right after registration, no confirmations are required. User does have attributesnrs_email_confirmed set to false
  2. Email Confirmation Required: account is ready to use right after registration but email confirmation is required that will effectively get snrs_email_confirmed set to true on Users profile upon confirmation
  3. Email Activation Required: activation email is being sent and only after activation account can be used. Activation also means that snrs_email_confirmed is set to true

Password

  1. Default password policy is: minimum 6 characters including at least one of: uppercase letter, lowercase letter, digit and non-alpha character.
  2. Passwords are PBKDF2 encrypted

User sign in

Once you User has been properly registered he can login and in order to provide such option you must implement: Client.signIn()

On success, application receives back JWT token which is valid for 1 hour (depending on backend configuration).

SDK is refreshing that token while user is working in application and events are being sent (autorefresh occurs only while token is still valid)

Note: Token longevity can be changed on request to different time value.

User sign out

In case you want to provide User with sign out feature in your Application you shall implement method - Client.registerAccount().

On request this methods will terminate JWT token and effectively kill User session.

Get User account details

Usually after login you may want to present User his profile details, in order to achieve that you need to implement - Client.getAccount().

It retrieves full User information that’s availabe at Synerise.

Tip: You can also implement our Cache Manager that’s providing access to User data stored in cache.

Update User account details

There is also possibility to provide User with ability to Update profile information. In order to get that working you need to implement: Client.updateAccount() Via this method your User can Update most of the information with exception of e-mail as it’s used as primary identifier for account.

Change Users password

Separately to User information updates we may want to change our passwords and in order to provide that option to USer you need to implement Client.changePassword()](developers/ios-sdk/user-identifcation/#change-users-password) Just please note that it’s required to enter current password as a security measure.

For full list of methods available for you please take a look to our Methods Reference.


OAuth Login

We also provide you a way to authenticate User based on your existing functionality, it works quite similar to what’s being done with Facebook but instead of validating User against of Facebook system we validate User from your backend.

Authentication process in this case works as folowing:

  1. User signs-in in your Application and that generates Auth request to your backend.
  2. Your backend on successful sign-in provides Application with some sort of access token.
  3. Such access token is passed to Synerise via usage of client.authenticateByOAuth() method.
  4. Synerise then passed that access token back to your System in order to check if it’s valid.
  5. In response we expect either success and User information like email, first name, last name or other details (we can map these values to client info in our System) OR in case access token not valid anything else than HTTP 2xx response.
  6. Assuming we received success from your system we will provide Application with our JWT access token for User (if it’s first time User authenticated we also do registration with user infromation provided).

Oauth Scheme

Once you authenticated and have JWT token in your Application you gain access to all methods and features provided by SDK.

You can retrieve client details via Client.getAccount() or further update his personal information via Client.updateAccount() same way as it’s available for Registration as a Service.


Facebook Login

For those Applications that rely on Facebook Login as authentication for App we have separate method that will provide you with Synerise JWT token based on Facebook login.

In order to achieve authentication based on Facebook you shall implement following methods:

  1. Client.authenticateByFacebookRegistered()

This method provides you authentication option bit similar to Client.signIn(), meaning it will do login only, in case it’s first use it will response with error that should be handled over in your Application and second method used then.

  1. Client.authenticateByFacebook()

This method is more extensive and in case it’s first time User authenticated it will create new User account in the system along with the details an optional agreements and attributes that you can pass via this method.

While it may seem bit too much, it’s done like that in order for you to determine if it’s first time use or not and potentially gather User agreements that you may require.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.