Getting Started with iglooconnect
Build for others. This guide helps you integrate with igloohome's API using OAuth 2.0 authentication via iglooconnect — for partners and integrators building on behalf of other igloohome account owners, whose end users log in and grant your application scoped access to their own locks. You'll learn how to:
- Set up authentication with iglooconnect
- Obtain and manage access tokens
- Make your first API calls
Managing only your own igloohome account and devices instead? See Getting Started with igloohome API — build for yourself.
Prerequisites
Before starting, ensure you have:
- A valid igloohome business partnership
- Your callback URL(s) ready
Authentication Setup
OAuth 2.0 Integration
igloohome uses the OAuth 2.0 Authorization Code flow (RFC 6749, section 4.1) for secure API access through iglooconnect.
This integration enables your users to authenticate with igloohome and grants your application access to their smart locks.
Authentication Flow Diagram
The following diagram illustrates the complete OAuth 2.0 authentication flow, from initial login through token refresh:
Flow Steps Explained
- User Authentication: The user initiates login within your app and is redirected to the igloohome secure login page.
- Authorization Code: Upon successful authentication, the user is redirected back to your defined callback URL with a temporary authorization code.
- Token Exchange: Your application exchanges this authorization code for long-lived access and refresh tokens.
- Secure Storage: Tokens and their calculated expiration times are stored securely in your database.
- API Access: The access token is used to authenticate requests to igloohome API endpoints.
- Token Refresh: Your application proactively refreshes credentials before they expire to ensure uninterrupted service.
Onboarding
To integrate with iglooconnect, you must first register your application and obtain credentials.
- Prepare Configuration: Determine your production callback URL(s). You can register multiple URLs if needed.
- Request Access: Contact your Business Development representative or the integration team.
- Receive Credentials: You will be issued a unique Client ID to identify your application.
Static Redirect URI
Your callback URLs must be static and use HTTPS. Dynamic URLs or plain HTTP are not supported for security reasons.
- Callback URL: Must be HTTPS and exactly match one of the URLs registered with igloohome.
- Client ID: The unique identifier provided during the onboarding process.
Scopes and Permissions
Scopes define what your application can access. Format: space-separated list of scope names. If no scopes are specified, all permissions are granted.
Available Scopes
| Scope | Description |
|---|---|
| igloohomeapi/algopin-permanent | Create permanent access AlgoPIN |
| igloohomeapi/algopin-onetime | Create one-time access AlgoPIN |
| igloohomeapi/algopin-daily | Create daily recurring AlgoPIN |
| igloohomeapi/algopin-hourly | Create hourly recurring AlgoPIN |
| igloohomeapi/create-pin-bridge-proxied-job | Create pins via bridge |
| igloohomeapi/delete-pin-bridge-proxied-job | Delete pins via bridge |
| igloohomeapi/lock-bridge-proxied-job | Lock devices via bridge |
| igloohomeapi/unlock-bridge-proxied-job | Unlock devices via bridge |
| igloohomeapi/get-devices | Retrieve device list |
| igloohomeapi/update-device | Config device setting |
| igloohomeapi/get-master-pin | Get Master PIN |
| igloohomeapi/get-properties | Get Properties |
| igloohomeapi/get-device-status-bridge-proxied-job | Get device status |
| igloohomeapi/get-battery-level-bridge-proxied-job | Get battery levels |
| igloohomeapi/get-activity-logs-bridge-proxied-job | Get activity logs |
| igloohomeapi/get-job-status | Get job status |
| igloohomeapi/create-ekey-access | Generate bluetooth key |
| igloohomeapi/get-device-activity | Get device activity log |
| openid | OpenID Connect authentication |
| profile | User profile information |
Implementation Guide
Initiate Authentication
Redirect users to igloohome's login page:
Parameters
| Parameter | Required | Description |
|---|---|---|
| response_type | Yes | Must be code |
| client_id | Yes | Your client ID from igloohome |
| redirect_uri | Yes | Your callback URL (URL encoded) |
| scope | Yes | Space-separated scope list |
| state | No | Recommended. Used for security and state preservation. |
State Parameter Usage
When your app adds a state parameter to a request, the server returns its value to your app when redirecting your user.
Common use cases:
- Security: Guard against Cross-Site Request Forgery (CSRF) attacks.
- Context/Identification: Identify your customer or maintain session state. You can include any data your integration requires to recognize the user or context upon their return.
Note: You can't set the value of a state parameter to a URL-encoded JSON string. To pass a string in that format, base64 encode it, then decode it in your app.
Example request:
Error Responses
| Error Code | Description | Solution |
|---|---|---|
| invalid_request | Missing required parameter (e.g., grant_type) | Check all required parameters are included |
| invalid_client | Invalid client ID or secret | Verify credentials with igloohome team |
| invalid_scope | Requested scope not available | Use only supported scopes from the list above |
| invalid_grant | Authorization code expired or already used | Request new authorization code |
Successful Authentication
After successful authentication, the server redirects to your callback URL with an authorization code. If a state parameter was provided in the initial request, it is returned here unchanged.
Exchange Authorization Code for Tokens
Make a POST request to exchange the authorization code for access tokens:
Example request:
Success Response
Response fields:
| Field | Description |
|---|---|
| id_token | Contains user identity claims (name, email) |
| access_token | JWT token for API authentication |
| refresh_token | Used to obtain new tokens (expires in 365 days) |
| expires_in | Access token lifetime in seconds (86400 = 1 day) |
| token_type | Always "Bearer" |
Error Response
| Error | Description |
|---|---|
| invalid_request | Missing required parameter (e.g., grant_type) |
| invalid_client | Client authentication failed |
| invalid_scope | Invalid scope requested |
| invalid_grant | Authorization code expired or already used |
Token Management
Access tokens expire after 24 hours and must be refreshed using the refresh token. The refresh token itself expires 1 year after the initial login.
Token Refresh Process
When an access token expires, use the refresh token to obtain a new access token:
Example request:
Recommended Practices
- Expiry Tracking: Calculate and store expiry timestamp for both access and refresh tokens
- Proactive Refresh: Refresh access tokens before expiry (recommended 1 hour before)
- User Re-authentication: Monitor refresh token expiry and prompt users to re-authenticate before the 1-year limit to prevent API access interruption
When the refresh token nears expiration (recommended 30 days before), prompt users to re-authenticate through the login flow to maintain uninterrupted API access.
Quick Start Checklist
Before You Begin
- Prepare HTTPS callback URL
Implementation Steps
- Redirect user to login page
- Handle callback with authorization code
- Exchange code for tokens
- Store tokens securely
- Make first API call
- Implement token refresh logic
Testing Your Integration
- Authentication Flow: Verify login redirect works
- Token Exchange: Confirm you receive valid tokens
- API Calls: Test with minimal scopes first
- Token Refresh: Verify refresh mechanism works
Troubleshooting
"Invalid redirect_uri"
Cause: Callback URL mismatch Solution: Ensure the redirect_uri exactly matches one of the URLs registered with igloohome
"403 Forbidden" on API calls
Cause: Insufficient scopes Solution: Check that your access token includes the required scope for the API endpoint
"Token expired" errors
Cause: Access token expired (24-hour limit) Solution: Implement automatic token refresh using the refresh_token
Getting Help
- Technical Issues: Contact your BD representative
- Integration Support: Email dev+support@igloohome.com