Sso API

To use Samsung Product API,

<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>

Should be loaded in index.html

This module defines the SSO functionalities provided by the Tizen Samsung Product API.

Since : 2.3

Product : TV, BD

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Summary of Interfaces and Methods

Interface Method
SsoManagerObject

SsoManager

void showAccountView(DOMString widgetName, SsoCallDataSuccessCallback onsuccess, optional ErrorCallback? onerror);
DOMString getVersion();
DOMString getLoginUid();
SsoLoginState getLoginStatus();
void showCreateAccountView(SsoNumSuccessCallback onsuccess, optional ErrorCallback? onerror);

SsoCallDataSuccessCallback

void onsuccess(SsoCallData data);

SsoStringSuccessCallback

void onsuccess(DOMString data);

SsoNumSuccessCallback

void onsuccess(Long data);

SsoLoginState

SsoTermsAgreementState

1. Type Definitions

1.1 SsoData

Defines a dictionary for login data.

dictionary SsoData {
  boolean bLogin;
  DOMString id;
  DOMString authToken;
  DOMString uid;
  DOMString guid;
};

The following values are supported

  • bLogin : Login status
  • id : Login ID
  • authToken : Login authentication token
  • uid : Login UID
  • guid : Login GUID

2. Interfaces

2.1 SsoManagerObject

Defines a WebApi object instance of the Tizen Samsung Product API.
The webapis.sso object enables access to SSO API functionality.

[NoInterfaceObject] interface SsoManagerObject {
  readonly attribute SsoManager sso;
};
WebApi implements SsoManagerObject;

Attributes

2.2 SsoManager

Provides methods for SSO functionalities.

[NoInterfaceObject] interface SsoManager {
  void showAccountView(DOMString widgetName, SsoCallDataSuccessCallback onsuccess, optional ErrorCallback? onerror);
  DOMString getVersion();
  DOMString getLoginUid();
  SsoLoginState getLoginStatus();
  void showCreateAccountView(SsoNumSuccessCallback onsuccess, optional ErrorCallback? onerror);
};

Methods

showAccountView

Shows the SSO login or logout page, and returns the SSO login or logout information.

void showAccountView(DOMString widgetName, SsoCallDataSuccessCallback onsuccess, optional ErrorCallback? onerror);

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Parameters :

  • widgetName : Widget name
  • onsuccess : Callback method to invoke when the account page is shown
  • onerror [optional][nullable] : Callback method to invoke if an error has occurred. It provides the status, error name, and error message.
    SecurityError, if the application does not have the privilege to call this method

Exceptions :

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
    • with error type NotSupportedError, if this feature is not supported.
    • with error type InvalidValuesError, if any input parameter contains an invalid value.
    • with error type UnknownError, for any other error.

Since : 2.3

Code Example :

var onsuccess = function(result) {
  console.log('success : ' + JSON.stringify(result));
};
var onerror = function (error) {
  console.log('error : ' + error);
};
webapis.sso.showAccountView("Facebook", onsuccess, onerror);

getVersion

Retrieves the plugin version number.

DOMString getVersion();

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Return Value :

  • DOMString : DOMString Version

Exceptions :

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
    • with error type NotSupportedError, if this feature is not supported.
    • with error type InvalidValuesError, if any input parameter contains an invalid value.
    • with error type SecurityError, if the application does not have the privilege to call this method.
    • with error type UnknownError, for any other error.

Since : 2.3

Code Example :

var result = webapis.sso.getVersion();

getLoginUid

Retrieves the UID.

The UID is considered personally-identifying information and must be handled according to the privacy regulations for each country.
It must not be used for any purpose other than as an input parameter for the Samsung Checkout API.
Whenever the UID value is sent outside the device, a secure protocol, such as HTTPS, must be used.

DOMString getLoginUid();

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Return Value :

  • DOMString : DOMString UID

Exceptions :

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
    • with error type NotSupportedError, if this feature is not supported.
    • with error type InvalidValuesError, if any input parameter contains an invalid value.
    • with error type InvalidStateError, if the user is not signed in.
    • with error type SecurityError, if the application does not have the privilege to call this method.
    • with error type UnknownError, for any other error.

Since : 2.3

Code Example :

var result = webapis.sso.getLoginUid();

getLoginStatus

Retrieves the SSO login status.

SsoLoginState getLoginStatus();

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Return Value :

Exceptions :

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
    • with error type NotSupportedError, if this feature is not supported.
    • with error type InvalidValuesError, if any input parameter contains an invalid value.
    • with error type SecurityError, if the application does not have the privilege to call this method.
    • with error type UnknownError, for any other error.

Since : 2.3

Code Example :

var result = webapis.sso.getLoginStatus();

showCreateAccountView

Shows the SSO account creation screen.

void showCreateAccountView(SsoNumSuccessCallback onsuccess, optional ErrorCallback? onerror);

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Parameters :

  • onsuccess : Callback method to invoke when the CreateAccountPage was closed. User can get number data(0).
  • onerror [optional][nullable] : Callback method to invoke if an error has occurred. It provides the status, error name, and error message.
    SecurityError, if the application does not have the privilege to call this method.

Exceptions :

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
    • with error type NotSupportedError, if this feature is not supported.
    • with error type InvalidValuesError, if any input parameter contains an invalid value.
    • with error type UnknownError, for any other error.

Since : 2.3

Code Example :

var onsuccess = function(result) {
  console.log('success : ' + result);
};
var onerror = function (error) {
  console.log('error : ' + error);
};
webapis.sso.showCreateAccountView(onsuccess, onerror);

2.3 SsoCallDataSuccessCallback

Defines the login success callback.

[Callback = FunctionOnly, NoInterfaceObject] interface SsoCallDataSuccessCallback {
  void onsuccess(SsoCallData data);
};

Methods

onsuccess

Callback method returning the login success data.

void onsuccess(SsoCallData data);

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Parameters :

  • data : Status

2.4 SsoStringSuccessCallback

Defines the success callback for string data.

[Callback = FunctionOnly, NoInterfaceObject] interface SsoStringSuccessCallback {
  void onsuccess(DOMString data);
};

Methods

onsuccess

Callback method returning string data.

void onsuccess(DOMString data);

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Parameters :

  • data : Status

2.5 SsoNumSuccessCallback

Defines the success callback for number data.

[Callback = FunctionOnly, NoInterfaceObject] interface SsoNumSuccessCallback {
  void onsuccess(Long data);
};

Methods

onsuccess

Callback method returning number data.

void onsuccess(Long data);

Privilege Level : Partner

Privilege : http://developer.samsung.com/privilege/sso.partner

Parameters :

  • data : Status

2.6 SsoLoginState

Defines constants for login status.

[NoInterfaceObject] interface SsoLoginState {
  const unsigned short SSO_NOT_LOGIN = 0;
  const unsigned short SSO_LOGIN = 1;
};

Constants

  • SSO_NOT_LOGIN
    Not logged in
  • SSO_LOGIN
    Logged in

2.7 SsoTermsAgreementState

Defines constants for agreement status.

[NoInterfaceObject] interface SsoTermsAgreementState {
  const unsigned short SSO_NOT_AGREE = 0;
  const unsigned short SSO_AGREE = 1;
};

Constants

  • SSO_NOT_AGREE
    Disagreed
  • SSO_AGREE
    Agreed

3. Full WebIDL

module Sso {
  dictionary SsoData {
    boolean bLogin;
    DOMString id;
    DOMString authToken;
    DOMString uid;
    DOMString guid;
  };

  [NoInterfaceObject] interface SsoManagerObject {
    readonly attribute SsoManager sso;
  };

  WebApi implements SsoManagerObject;

  [NoInterfaceObject] interface SsoManager {
    void showAccountView(DOMString widgetName, SsoCallDataSuccessCallback onsuccess, optional ErrorCallback? onerror);
    DOMString getVersion();
    DOMString getLoginUid();
    SsoLoginState getLoginStatus();
    void showCreateAccountView(SsoNumSuccessCallback onsuccess, optional ErrorCallback? onerror);
  };

  [Callback = FunctionOnly, NoInterfaceObject] interface SsoCallDataSuccessCallback {
    void onsuccess(SsoCallData data);
  };

  [Callback = FunctionOnly, NoInterfaceObject] interface SsoStringSuccessCallback {
    void onsuccess(DOMString data);
  };

  [Callback = FunctionOnly, NoInterfaceObject] interface SsoNumSuccessCallback {
    void onsuccess(Long data);
  };

  [NoInterfaceObject] interface SsoLoginState {
    const unsigned short SSO_NOT_LOGIN = 0;
    const unsigned short SSO_LOGIN = 1;
  };

  [NoInterfaceObject] interface SsoTermsAgreementState {
    const unsigned short SSO_NOT_AGREE = 0;
    const unsigned short SSO_AGREE = 1;
  };

};