Authenticate your users

In this section, we explain how to manage user connection with the SDK.

Prerequisites

As StayTuned authentication features require a previous partner integration with your own authentication system, you'll need to first contact us so we can process this integration

Feature specification

Android
iOS
Web
Android

Coming soon

iOS

Coming soon

Web
export interface ISTAuthSDK {
/**
* Connect a user
* @param partnerKey The partner key
* @param partnerToken The partner auth token
*/
connect(partnerKey: string, partnerToken: string): Promise<void>;
/**
* Disconnect a user
*/
disconnect(): void;
/**
* Retrieve last connection (doesn't work after a disconnect)
*/
retrieveLastConnection(): Promise<void>;
}

Examples

Connect a user

Android
iOS
Web
Android

Coming soon

iOS

Coming soon

Web
// Connect user (throw an error if the given fields don't allow a connection)
await staytunedSDK.STAuth.connect('partner-key', 'partner-token');
// Then authenticated features will be enabled

Disconnect a user

Android
iOS
Web
Android

Coming soon

iOS

Coming soon

Web
// Disconnect an authenticated
staytunedSDK.STAuth.disconnect();
//authenticated features will be not be enabled anymore and will throw an error

Retrieve last connection

This is more likely to be used when a user arrives on an app or a website without having disconnected from his last session

Android
iOS
Web
Android

Coming soon

iOS

Coming soon

Web
// Retrieve a user last connection
await staytunedSDK.STAuth.retrieveLastConnection();
// Then authenticated features will be enabled