top

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 TV Product API.

Since : 2.3

Product : TV, AV_BD

Privilege level: Partner

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

Table of Contents

  1. 1. Type Definitions
    1. 1.1. SsoCallData
  2. 2. Interfaces
    1. 2.1. SsoManagerObject
    2. 2.2. SsoManager
    3. 2.3. SsoCallDataSuccessCallback
    4. 2.4. SsoStringSuccessCallback
    5. 2.5. SsoSnsListSuccessCallback
    6. 2.6. SsoLoginState
    7. 2.7. SsoTermsAgreementState
  3. 3. Full WebIDL

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(SsoStringSuccessCallback onsuccess, optional ErrorCallback ? onerror);
SsoCallDataSuccessCallback void onsuccess(SsoCallData data);
SsoStringSuccessCallback void onsuccess(DOMString data);
SsoSnsListSuccessCallback void onsuccess(DOMString SNSList);
SsoLoginState  
SsoTermsAgreementState  

1. Type Definitions

1.1. SsoCallData

Defines a dictionary for call success data.

dictionary SsoCallData{
  DOMString status;
};

The following values are supported

  • status : Login status

2. Interfaces

2.1. SsoManagerObject

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

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

Attributes

  • readonly SsoManagerObject sso
    SSO API namespace

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(SsoStringSuccessCallback 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);

Since : 2.3

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]: Callback method to invoke if an error has occurred. It provides the status, error name, and error message.

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.

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( );

Since : 2.3

Privilege level: Partner

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

Return value:

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.

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 TV device, a secure protocol, such as HTTPS, must be used.

DOMString getLoginUid();

Since : 2.3

Privilege level: Partner

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

Return value:

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.

Code example:


var result = webapis.sso.getLoginUid();
getLoginStatus
Retrieves the SSO login status.

SsoLoginState getLoginStatus();

Since : 2.3

Privilege level: Partner

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

Return value:

SsoLoginState Login State

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.

Code example:


var result = webapis.sso.getLoginStatus();
showCreateAccountView
Shows the SSO account creation screen.

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

Since : 2.3

Privilege level: Partner

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

Parameters:

  • onsuccess: Callback method to invoke when the CreateAccountPage is shown
  • onerror [optional]: Callback method to invoke if an error has occurred. It provides the status, error name, and error message.

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.

Code example:


var onsuccess = function(result) {
  console.log('success : ' + JSON.stringify(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);

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);

Parameters:

  • data: Status

2.5. SsoSnsListSuccessCallback

Defines the success callback for string data.
[Callback = FunctionOnly, NoInterfaceObject]interface SsoStringSuccessCallback {
  void onsuccess(DOMString data);
};

Methods

onsuccess
Defines the SNS list success callback.

void onsuccess(DOMString SNSList);

Parameters:

  • SNSList: SNSList

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 SsoLoginState {
  const unsigned short SSO_NOT_LOGIN = 0;
  const unsigned short SSO_LOGIN = 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;
  };

  dictionary SsoCallData{
    DOMString status;
  };

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

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

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

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

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

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

  [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;
  };
};