@tceu/tceu-tid-auth
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Generate the definition files

tsc -p tsconfig.json

On UI component mount or button click:

const authConfiguration = new TIDV4.TIDConfiguration();
        authConfiguration.client_id="8180fcc7-43f3-42a8-833a-a6258e299fa3";
        authConfiguration.env = TIDV4.TIDEnvironment.STAGING;
        authConfiguration.redirect_uri="http://localhost:5000/auth";
        authConfiguration.tid_app_name="PrototypeLeaflet";
var tid = new TIDV4.TID(authConfiguration);

onMount(() => {

    document.getElementById("start").addEventListener("click", async (e) => {

        e.preventDefault();
        tid.startAuthentication();
        
    });
    
});

If the redirect address is /auth then the tokens can be obtained in a similar manner as below:

router('/Auth', () => {
    tid.concludeAuthentication().then(
        (response) => {console.log("Access token: " + response.access_token);},
         (error) => {console.error("Error authenticating: " + error);}
         );
    page = Auth;
});

Package Sidebar

Install

npm i @tceu/tceu-tid-auth

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

17.7 kB

Total Files

14

Last publish

Collaborators

  • aurelien.boubennec