Edit on GitHub
Report issue
Page history

Submitted by @{[ TutorialCtrl.tutorial.github_username ]} {[ TutorialCtrl.tutorial.date_published | date:'mediumDate' ]}

title: Authenticating to the 23andMe API with the Google Java OAuth 2.0 Client description: Authenticate to the 23andMe API with the Google Java OAuth 2.0 client and pull a single genotype for i3003137, a SNP associated with Sickle Cell Anemia. author: dennisbyrne tags: OAuth, OAuth2, Java, 23andMe, genomics date_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 http://127.0.0.1:8080/Callback. 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

See more by @{[ TutorialCtrl.tutorial.github_username ]} and more tagged {[ tag ]}{[ $last ? '' : ', ' ]}

Submit a Tutorial

Share step-by-step guides

SUBMIT A TUTORIAL

Request a Tutorial

Ask for community help

SUBMIT A REQUEST

GCP Tutorials

Tutorials published by GCP

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.