Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #122 from deflaux/master
Browse files Browse the repository at this point in the history
 Add OAuth scope to credential, if missing.
  • Loading branch information
deflaux committed Oct 30, 2017
2 parents 6fde680 + 8af7416 commit 6827e5f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
24 changes: 24 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Copyright (C) 2017 Google Inc.

# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

set -o nounset
set -o errexit

# Check that required variables are explicitly set.
GOOGLE_API_KEY="$GOOGLE_API_KEY"
GOOGLE_APPLICATION_CREDENTIALS="$GOOGLE_APPLICATION_CREDENTIALS"
TEST_PROJECT="$TEST_PROJECT"

echo -e "\n\n\nRunning unit and integration tests."
mvn test javadoc:javadoc verify
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ public String getRedirectUri() {
*/
public static GoogleCredential getApplicationDefaultCredential() {
try {
return GoogleCredential.getApplicationDefault();
GoogleCredential credential = GoogleCredential.getApplicationDefault();
if (credential.createScopedRequired()) {
credential =
credential.createScoped(Arrays.asList("https://www.googleapis.com/auth/genomics"));
}
return credential;
} catch (IOException e) {
throw new RuntimeException(MISSING_ADC_EXCEPTION_MESSAGE, e);
}
Expand Down

0 comments on commit 6827e5f

Please sign in to comment.