Menguji reCAPTCHA di situs demo
Dokumen ini menunjukkan cara men-deploy situs demo di Google Cloud, yang merupakan situs contoh yang terintegrasi dengan reCAPTCHA, untuk memahami cara kerja reCAPTCHA.
Situs demo membantu Anda melakukan hal berikut:
- Pahami pengalaman pengguna Anda dengan reCAPTCHA.
- Gunakan sebagai referensi untuk mengintegrasikan reCAPTCHA di aplikasi Anda sendiri.
- Bereksperimenlah dengan berbagai pendekatan frontend dan backend dengan mengedit kode sumber aplikasi contoh.
Anda dapat men-deploy situs demo dalam salah satu bahasa berikut: Java, Node.js, atau Python.
Untuk project Google Cloud , Anda hanya dapat men-deploy satu situs demo dalam satu waktu.
Sebelum memulai
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
Enable the reCAPTCHA Enterprise API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.Make sure that you have the following role or roles on the project: reCAPTCHA Enterprise Admin, reCAPTCHA Enterprise Agent
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Buka IAM - Pilih project.
- Klik Grant access.
-
Di kolom New principals, masukkan ID pengguna Anda. Biasanya, ini adalah alamat email untuk Akun Google.
- Klik Pilih peran, lalu telusuri peran.
- Untuk memberikan peran tambahan, klik Add another role, lalu tambahkan tiap peran tambahan.
- Klik Simpan.
Jika sebelumnya Anda telah men-deploy situs demo, hapus kunci demo yang relevan.
-
Men-deploy situs demo
Di konsol Google Cloud , buka halaman situs demo.
Dalam daftar Language, pilih bahasa.
Seluruh proses deployment mungkin memerlukan waktu sekitar 1 menit.
Jika diminta, beri otorisasi Cloud Shell untuk melakukan panggilan menggunakan kredensial Anda.
Untuk membuka halaman Detail utama demo baru, klik Lihat situs.
Untuk melihat situs demo, di kartu Frontend, klik View sample web page.
Situs demo akan terbuka di tab terpisah.
Untuk mempelajari pola integrasi reCAPTCHA dengan situs Anda, klik contohnya.
Jika Anda ingin membuat perubahan pada situs demo, lakukan hal berikut:
- Di halaman Key details, klik Edit source.
Di Cloud Shell Editor, temukan file yang diperlukan di Explorer dan edit sesuai kebutuhan.
Perubahan yang disimpan pada kode sumber akan dimuat ulang ke situs demo.
Jangan tutup Editor Cloud Shell karena akan menutup Cloud Shell dan menghentikan situs demo.