2.3.0 • Published 4 years ago

csg-session-timer v2.3.0

Weekly downloads
3
License
MIT
Repository
-
Last release
4 years ago

csg-session-timer

Table of Contents

To install, you can use npm or yarn:

$ npm install csg-session-timer
$ yarn add csg-session-timer

Examples

Here is a simple example of csg-session-timer being used in an app

import React from 'react';
import ReactDOM from 'react-dom';
import CsgSessionTimer from 'csg-session-timer'
import CSGApiClient from './common/api/csg/CSGApiClient'

// initializing the props to pass to the component
const appElement = "#main" // Make sure this element is used in all authenticated views/layouts of your app
const sessionResource = "http://myapi.mywebapp.com/v1/auth/users/sessions.json" // *required* URL to the REST API endpoint for your session management
const refreshSessionResource = "http://myapi.mywebapp.com/oauth/v1/token"; // *required* URL to the REST API endpoint for your session extension (uses HTTP HEAD request)
const sessionLimit = 1000*60*25 //*required* the time limit for your web session represented in miliseconds 
const timerDuration = 1000*60*5 //*required* the amount of time, represented in miliseconds, to give users to extend their session to be shown in a popup dialog
const logoutURI = "/auth/signout" // *optional* defaults to "/auth/signout";
const clientResource = CSGAPIClient //We use CSGAPI client to make authenticated calls to the API 

ReactDOM.render(
    <React.StrictMode>
        <CsgSessionTimer
            sessionResource={session} 
            logOutRedirectURI={logoutURI}
            sessionLimit={sessionLimit}
            timerDuration={timerDuration}
            refreshSessionResource={refreshSessionResource}
            appElement={"root"}
            clientResource={CSGApiClient}
        />
    </React.StrictMode>,, 
    appElement);
2.3.0

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago