Skip to content

Commit

Permalink
Update migration-script-ubuntu.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
JayanaGunaweera01 committed Jun 28, 2023
1 parent 42e42cd commit d3a2082
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,6 @@ access_token=$(curl --location --request POST 'https://oauth2.googleapis.com/tok
--data-urlencode 'refresh_token='$gcpRefreshToken'' \
--data-urlencode 'grant_type=refresh_token' | jq -r '.access_token')

# Check if the response contains any error message
if echo "$access_token" | grep -q '"error":'; then
# If there is an error, print the failure message with the error description
error_description=$(echo "$access_token" | jq -r '.error_description')
echo -e "${RED}${BOLD}Failure in generating an access token $error_description${NC}"
else
# If there is no error, print the success message
echo -e "${PURPLE}${BOLD}Success: An access token generated successfully.${NC}"
# Save the access token to a file called "access_token"
echo "$access_token" > access_token
fi

# Specify the Google Drive file URL
file_url="$urlOld"

Expand All @@ -121,7 +109,7 @@ file_id=$(echo "$file_url" | awk -F'/' '{print $NF}' | awk -F'=' '{print $2}')

# Download the file using the access token from the "access_token" file
access_token=$(cat access_token)
response=$(curl "https://www.googleapis.com/drive/v3/files/1pePZJM0gIFlPft8qSsu4613kiVzuLQHs?alt=media" \
response=$(curl "https://www.googleapis.com/drive/v3/files/$file_id?alt=media" \
--header "Authorization: Bearer $access_token" \
--header "Accept: application/json" \
--compressed -O wso2is.zip)
Expand Down

0 comments on commit d3a2082

Please sign in to comment.