Edit on GitHub
Report issue
Page history

Authenticating to the 23andMe API with the Google Java OAuth 2.0 Client

Author(s): @dennisbyrne ,   Published: 2017-04-26

This sample app uses Google's OAuth 2.0 java lib to authenticate with 23andMe. Once authenticated the app pulls a single genotype for i3003137, a SNP associated with Sickle Cell Anemia.

Create a 23andMe client

Follow the instructions at https://api.23andme.com/apply/ to create a 23andMe Oauth client. Make sure to set your redirect_uri to You will be given a client_id and a client_secret.

Clone the community repo

  git clone https://github.com/GoogleCloudPlatform/community.git

Run the sample app

  cd community/tutorials/oauth2-with-23andMe-in-java/java/

Make sure you have maven installed, then run the app:

  mvn compile && mvn -q exec:java -Dexec.args="`client_id` `client_secret`"

Example output

Genotype @ i3003137, a SNP associated with Sickle Cell Anemia: TT

Submit a tutorial

Share step-by-step guides

Submit a tutorial

Request a tutorial

Ask for community help

Submit a request

View tutorials

Search Google Cloud tutorials

View tutorials

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Site Policies. Java is a registered trademark of Oracle and/or its affiliates.