Class: Auth

Auth

Auth: handling Pryv authentication through browser popup

Constructor

new Auth()

Source:

Methods

internalError(message:, jsonData:)

Throw an internal error

Parameters:
Name Type Description
message:

error message

jsonData:

error data

Source:

login(settings:)

Login the user and save references TODO: discuss whether signature should be (settings, callback)

Parameters:
Name Type Description
settings:

authentication settings

Source:

loginWithCookie(settings:) → {*}

Login the user using stored cookies TODO: belong elsewhere, merge with standard login? (e.g. member method of Connection)

Parameters:
Name Type Description
settings:

authentication settings

Source:
Returns:

: a successful connection or false

Type
*

logout()

Logout the user and clear all references

Source:

poll()

Read the polling route using a polling key

Source:

popupCallBack(event:) → {boolean}

Messaging between browser window and window.opener

Parameters:
Name Type Description
event:

message from browser

Source:
Returns:

: false in case of error

Type
boolean

popupLogin() → {boolean}

Display the login popup

Source:
Returns:

: false in case of error

Type
boolean

setup(settings:) → {Connection}

Setup the authentication process //TODO check settings

Parameters:
Name Type Description
settings:

initialization settings

Source:
Returns:

: the connection managed by Auth. A new one is created each time setup is called.

Type
Connection

stateAccepted()

State 2: Accepted The user is logged in and authorized, saves the credentials

Source:

stateChanged(data:)

Handles state changes

Parameters:
Name Type Description
data:

the new state data

Source:

stateInitialization()

State 0: Initialization Pryv button is loading

Source:

stateNeedSignin()

State 0: Need Signin Wait the user to sign in

Source:

stateRefused()

State 3: User refused The user is notified about refused access

Source:

trustedLogout()

Trusted logout with Pryv API call TODO: belong elsewhere, useful? (e.g. static method of Connection)

Source:

uiButton(onClick:, buttonText:) → {string}

Generate Pryv login button

Parameters:
Name Type Description
onClick:

id of the event to trigger when button is clicked

buttonText:

button label

Source:
Returns:

: html code of the generated Pryv button

Type
string

uiConfirmLogout()

Signout Button

Source:

uiErrorButton()

Error button

Source:

uiInButton(username:)

Confirm logout Button

Parameters:
Name Type Description
username:

user to be logout

Source:

uiLoadingButton()

Loading button

Source:

uiRefusedButton(message:)

Access refused Button

Parameters:
Name Type Description
message:

reason for refusal

Source:

uiSigninButton()

Signin Button

Source:

updateButton(html:)

Update Pryv button included in the webpage

Parameters:
Name Type Description
html:

html code of the Pryv button

Source:

whoAmI(settings:)

Request for access information TODO: belong elsewhere? (e.g. static method of Connection)

Parameters:
Name Type Description
settings:

request settings

Source: