OAuth2 data access

Once a member authorizes data sharing, you'll be able to immediately access that data via our API.

Topics:

API data access: Project member endpoint

Using access tokens for specific users, OAuth2 projects can use this endpoint to:

  • retrieve the user's project member ID
  • access other data associated with the project member

There are two ways to use this endpoint. The first is to send a secure GET request (using 'https') to the following URL with the access_token parameter set to the user's OAuth2 "access token":

https://www.openhumans.org/api/direct-sharing/project/exchange-member/?access_token=<USER_ACCESS_TOKEN>

The second is to send a secure GET request ('https') to the following URL with the access_token parameter set to the project's "master access token" and the project_member_id set to the project member's "project member id".

This returns JSON-formatted data that can be used to programmatically access and retrieve data files and other information for this specific project member. Data file information is paginated and, by default, lists a maximum of 100 data files. The returned JSON includes: "count", which is the total number of data files, "next", the URL for the next page of data files (if there are more to be listed), and "previous", the URL for the previous page of data files (if one exists).

Social log in with an Open Humans account

This endpoint can also be used to perform "social login" – users could log in to your site "through" Open Humans. If you expect users to be Open Humans members, this could simplify account management.

API data access: master access token endpoint

In addition to traditional OAuth2 access tokens, your project will also have access to a "master access token" and associated APIs.

We recommend OAuth2 projects use OAuth2 API endpoints when possible.

If you wish to use master access token endpoints, consult documentation for "On-site" projects.

API data access: Project information

OAuth2 and master access tokens can also both be used to retrieve information about the project they are related to.

To use this endpoint, send a secure GET request (using 'https') to the following URL with the 'access_token' parameter set to access token:

https://www.openhumans.org/api/direct-sharing/project/?access_token=<ACCESS_TOKEN>

This returns JSON-formatted data related to the project itself.