0

At the beginning, the server generated the Google Form, which worked and could be accessed. However, starting from March 18th, 2023 until March 23rd, 2023, users who tried to access these Google Forms, will see a 'permission denied' message.

The form url begin: https://docs.google.com/forms/d/e/1FAIpQLSeIna5SYt5s7XVJTqpjkgZJJ0On8wYKZ_BsHNvtH62gyk0eKg/viewform after access url : https://docs.google.com/forms/d/e/1FAIpQLSeIna5SYt5s7XVJTqpjkgZJJ0On8wYKZ_BsHNvtH62gyk0eKg/formrestricted?pli=1

export default class FormService {
    authClient: JWT

    async initialize(): Promise<void> {
        const file = await this.readConfigFile('./credentials.json')
        const auth = new google.auth.JWT({
            email: file.client_email,
            key: file.private_key,
            scopes: [
                'https://www.googleapis.com/auth/drive',
                'https://www.googleapis.com/auth/forms'
            ]
        })

        const token: Credentials = await auth.authorize()
        auth.setCredentials(token)
        this.authClient = auth
    }

    create googleForm() {
      const createRes = await service.forms.create({
            requestBody: {
                info: {
                    title: `XXXXXX)`,
                    documentTitle: '907_questionnaire'
                }
            }
        })
        const formId = createRes.data.formId
                await this.createItem(formId)

      }

async createItem(formId: string) {
        const service = google.forms({
            version: 'v1',
            auth: this.authClient
        })

        const res = await service.forms.batchUpdate({
            formId,
            requestBody: {
                requests: [
                    {
                        createItem: q1_item
                    },
                ]
            }
        })
        return res.data
    }
}

I want to know why some google form will appear permission denied. No matter, I am using same code to gen the google form

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
James
  • 1
  • 1

0 Answers0