A Swift interface to the Harvest time tracking API
See the Harvest API V2 Documentation to learn how the Harvest REST API is structured.
Harvester is distributed as a Swift package. The repository URL is https://github.com/tin-whistle/Harvester.git
Authentication is done using the OAuth 2 standard. The Harvester library uses the Authorization Code flow option. The Harvester example project uses the OAuthSwift library, but you may choose to use another library or write your own implementation. The only requirement is that your OAuth library must conform to the OAuthProvider protocol.
Any app which wishes to use the Harvest API must first be registered with Harvest (requires a Harvest account).
- Once logged in, chose Create New OAuth2 Application.
- Fill in the app Name.
- Fill in the Redirect URL.
- Harvest API only supports standard HTTP or HTTPS redirect URLs. Therefore, your app must support Universal Links using an associated domain.
- Set Multi Account to I need access to one account.
- Set Products to I want access to Harvest.
- Choose Create Application.
- Use the Client ID and Client Secret values generated on this page with your OAuth library or custom implementation.
In order for Harvester to make authorized requests to the Harvest API, it must have the proper OAuth credentials. These are provided by the OAuthProvider protocol. This protocol provides essential functions needed to interact with your chosen OAuth library or custom implementation. It allows Harvester to check authorization status, authorize and deauthorize the app, and make generic authorized network requests. The example app contains an implementation for the OAuthSwift library.
- appName - The name of your app. This is sent to Harvest as part of a user agent string. It is used to identify which app a request came from.
- contactEmail - The email address which Harvest should use to contact you with questions or comments. This is sent to Harvest as part of a user agent string.
- oauthProvider - Your OAuthProvider implementation (see OAuthProvider section above).