@tceu/tceu-tid-auth
v1.0.1
Published
Typescript library that brings Trimble's TID V4 oAuth authorization code flow with PKCE to your web application.
Downloads
6
Maintainers
Readme
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;
});