JS
Integrating Eartho into Your JavaScript App
This section describes how to integrate Eartho into a JavaScript app.
1. Install the SDK
You can install the SDK using npm or include it via a CDN.
Using npm:
Using a CDN:
2. Retrieve Eartho Client ID and Access ID
Go to Eartho Creator and copy your Eartho client ID and access ID from the "Developers Integration" section.
3. Initialize and Configure the SDK
Integrate Eartho into your app by configuring the SDK and handling authentication:
Example Code:
Explanation:
Include SDK: The SDK is included using a CDN link.
Initialize SDK: The
earthoOneConfig
object is created with the necessary configuration, including the client ID and redirect URI.Connect and Authenticate: The
connectToAccess
function triggers the Eartho login process using theconnectWithPopup
method. Upon successful authentication, it retrieves and logs the user's ID token and profile information.Logout: The
logout
function logs the user out and redirects them to the home page.
Additional Resources
For more detailed examples and usage, visit the Eartho JS Example Repository.
Last updated