Connecting to Strava
To authenticate to Strava, and connect to your own data or to allow other users to connect to their data, you can use the OAuth standard.
Using OAuth Authentication
You must create a custom OAuth application to connect to Strava. To create a custom OAuth application:
- Log into the Strava API Settings page
- Create a new application or select an existing application
- Set the "Authorization Callback Domain" to your callback URL domain (e.g. localhost)
- Note down the Client ID and Client Secret
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to OAuth.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to manage the process to obtain the OAuthAccessToken.
- OAuthClientId: Set this to the Client ID from your Strava API application.
- OAuthClientSecret: Set this to the Client Secret from your Strava API application.
- CallbackURL: Set this to the redirect URI matching your application's callback domain.
Example connection string:
Profile=C:\profiles\Strava.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackURL=http://localhost:33333;
Usage Examples
Athlete
Get the authenticated athlete:
SELECT * FROM Athlete
Get athlete stats:
SELECT * FROM AthleteStats WHERE AthleteId = '1073459846'
Get athlete zones:
SELECT * FROM AthleteZones
Activities
Get all activities:
SELECT * FROM Activities
Get comments for an activity:
SELECT * FROM ActivityComments WHERE ActivityId = '17686290593'
Get kudoers for an activity:
SELECT * FROM ActivityKudoers WHERE ActivityId = '17686290593'
Get laps for an activity:
SELECT * FROM ActivityLaps WHERE ActivityId = '17686290593'
Get activity streams:
SELECT * FROM ActivityStreams WHERE ActivityId = '17686290593'
Get activity zones:
SELECT * FROM ActivityZones WHERE ActivityId = '17686290593'
Clubs
Get all clubs:
SELECT * FROM Clubs
Get club activities:
SELECT * FROM ClubActivities WHERE ClubId = '620542'
Get club admins:
SELECT * FROM ClubAdmins WHERE ClubId = '620542'
Get club members:
SELECT * FROM ClubMembers WHERE ClubId = '620542'
Segments
Explore segments by location:
SELECT * FROM ExploreSegments WHERE bounds = '37.821362,-122.505373,37.842038,-122.465977'
Get a specific segment:
SELECT * FROM Segments WHERE SegmentId = '25446614'
Get segment efforts:
SELECT * FROM SegmentEfforts WHERE SegmentId = '25446614'
Get segment streams:
SELECT * FROM SegmentStreams WHERE SegmentId = '25446614'
Get segment effort streams:
SELECT * FROM SegmentEffortStreams WHERE SegmentEffortId = '3466842674864856094'
Routes
Get all routes:
SELECT * FROM Routes
Get route streams:
SELECT * FROM RouteStreams WHERE RouteId = '3466814442173653556'
Gear
Get gear details:
SELECT * FROM Gear WHERE GearId = 'g29532578'
Uploads
Get upload status:
SELECT * FROM Uploads WHERE UploadId = '18784735877'
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| AuthScheme | The scheme used for authentication. Accepted entries are OAuth or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |
| CallbackURL | Identifies the URL users return to after authenticating to API via OAuth (Custom OAuth applications only). |
| InitiateOAuth | Specifies the process for obtaining or refreshing the OAuth access token, which maintains user access while an authenticated, authorized user is working. Allowed values are: OFF, REFRESH, GETANDREFRESH |
| OAuthAccessToken | Specifies the OAuth access token used to authenticate requests to the data source. This token is issued by the authorization server after a successful OAuth exchange. |
| OAuthClientId | Specifies the client ID (also known as the consumer key) assigned to your custom OAuth application. This ID is required to identify the application to the OAuth authorization server during authentication. |
| OAuthClientSecret | Specifies the client secret assigned to your custom OAuth application. This confidential value is used to authenticate the application to the OAuth authorization server. (Custom OAuth applications only.). |
| OAuthExpiresIn | Specifies the duration in seconds, of an OAuth Access Token's lifetime. The token can be reissued to keep access alive as long as the user keeps working. |
| OAuthRefreshToken | Specifies the OAuth refresh token used to request a new access token after the original has expired. |
| OAuthSettingsLocation | Specifies the location of the settings file where OAuth values are saved. |
| OAuthTokenTimestamp | Displays a Unix epoch timestamp in milliseconds that shows how long ago the current access token was created. |
| OAuthVerifier | Specifies a verifier code returned from the OAuthAuthorizationURL . Used when authenticating to OAuth on a headless server, where a browser can't be launched. Requires both OAuthSettingsLocation and OAuthVerifier to be set. |
| Scope | Scope(s) to use when authenticating, that control access to specific information. |