Sergey Slepov
Sergey Slepov

Reputation: 2121

How to avoid UrlFetchApp failing with error 403

I've written my first bit of Google Apps Script to call a REST endpoint:

function russianDeclension(input) {
  let response = UrlFetchApp.fetch("https://ws3.morpher.ru/russian/declension?format=json&s=" + input)
  let json = response.getDataAsString();
  //let json = "{\"Д\":\"Петру\"}";
  let p = JSON.parse(json)
  return p.Д;
}

console.info(russianDeclension("Петр"));

When I click Run, I get the following message:

Authorization required

This project requires your permission to access your data.

Question 1: Why I am getting this? What personal data is my script trying to access?

After clicking REVIEW PERMISSIONS, I choose my Google account and then get the following message:

Access blocked: [My Script] has not completed the Google verification process

<my_email>@gmail.com

[My Script] has not completed the Google verification process. The app is currently being tested and can only be accessed by developer-approved testers. If you think you should have access, contact the developer.

If you are a developer of [My Script], see error details.

Error 403: access_denied

  1. How do I avoid this?

The error details are as follows:

Error 403: access_denied

Request details: access_type=offline [email protected] hl=en_US response_type=none gsession redirect_uri=https://script.google.com/oauthcallback state=10656987804787015680 client_id=318389745225-nkegj410807ie1hi0io0tei5fpn7jo2t.apps.googleusercontent.com prompt=consent scope=https://www.googleapis.com/auth/script.external_request

Related developer documentation

Upvotes: 0

Views: 125

Answers (1)

Sergey Slepov
Sergey Slepov

Reputation: 2121

  1. After I've added my email to Test Users on the OAuth Concent Screen, the error went away.

Still wondering what personal data UrlFetchApp is using.

Upvotes: 0

Related Questions