1.0.1 • Published 3 years ago

@tceu/tceu-tid-auth v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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

3 years ago

1.0.0

3 years ago