This example shows how to implement OAuth 2.0 authorization flow with the Samsara API using Java.
- Java 17 or higher
- Maven 3.6 or higher
- A Samsara account with dashboard access
- Your Application Client ID and Client Secret
-
Clone this repository
-
Create a
.env
file in the root directory.
cp .env.example .env
- Add your Client ID and Client Secret to the
.env
file.
SAMSARA_CLIENT_ID=your_client_id
SAMSARA_CLIENT_SECRET=your_client_secret
- Install dependencies with Maven
mvn package
- Run the server
java -cp target/oauth2-example-1.0-SNAPSHOT.jar com.samsara.dev.Server
- Navigate to
http://localhost:5000
in your browser.
If you have any questions or need assistance with the samples, please ask a question in the Developer Community.