Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
transposit
Advanced tools
SDK for web apps using Transposit as a backend.
To learn more about Transposit as a backend, see the Transposit documentation.
Install with npm
or embed the library in a <script>
tag.
$ npm install transposit
<script src="https://unpkg.com/transposit@1.0.0/dist/bundle.prod.js"></script>
Instantiate the SDK with the hosted app origin that uniquely identifies your application:
import { Transposit } from "transposit";
const transposit = new Transposit("https://hello-world-xyz12.transposit.io");
<script>
const transposit = new Transposit.Transposit("https://hello-world-xyz12.transposit.io");
</script>
Call your backend through an idiomatic library.
transposit
.runOperation("myOperation")
.then(response => {
if (response.status !== "SUCCESS") {
throw response;
}
const results = response.result.results;
})
.catch(response => {
console.log(response);
});
If your web app requires sign-in, implement these routes.
/signin
: Displays a sign-in button/handle-signin
: Handles redirection after successful sign-in/signin
Create a page that displays a sign-in button. Use the SDK to begin sign-in when the button is clicked.
<button type="button" onclick="signin()">Sign in</button>
<script>
function signin() {
window.location.href = transposit.startLoginUri(
// Specify where to redirect after sign-in is successful
`${window.location.origin}/handle-signin`
);
}
</script>
Specify <your-site>/handle-signin
as a Successful sign-in URI when you enable user sign-in in Transposit.
/handle-signin
Create a page that handles redirection at the end of sign-in. Use the SDK to complete sign-in when the page loads. You do not need to render anything on this page if you redirect once sign-in is complete.
<script>
try {
transposit.handleLogin(() => {
// Specify where to redirect after sign-in completes
window.location.href = "/";
});
} catch (err) {
console.log(err);
window.location.href = "/signin";
}
</script>
For all routes that require sign-in, check if the user is signed-in. Redirect to your sign-in page if they are not.
<script>
if (!transposit.isLoggedIn()) {
window.location.href = "/signin";
}
</script>
Render a sign-out button. Use the SDK to sign out when the buttons is clicked.
<button type="button" onclick="signout()">Sign out</button>
<script>
function signout() {
transposit.logOut(`${window.location.origin}/signin`);
}
</script>
Allow users to grant access to their third-party data. Use the SDK to link users to the Transposit settings page.
<button type="button" onclick="settings()">Settings</button>
<script>
function settings() {
window.location.href = transposit.settingsUri();
}
</script>
Absolutely! See the Transposit reference documentation.
File an issue against this repository.
Check out the Transposit documentation. Email support@transposit.com.
The Transposit JavaScript SDK is licensed under the Apache License, Version 2.0.
FAQs
SDK for web apps using Transposit as a backend
The npm package transposit receives a total of 10 weekly downloads. As such, transposit popularity was classified as not popular.
We found that transposit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.