Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Hướng dẫn này giúp bạn xác minh rằng bạn đã hoàn tất chế độ uỷ quyền Fleet Engine và có thể tạo một chiếc xe dùng thử. Hướng dẫn này sử dụng tiện ích dòng lệnh gcloud để kiểm thử việc ký mã thông báo uỷ quyền và tạo xe.
Để hoàn tất quy trình này, hãy làm như sau:
Thay thế các trường bên dưới bằng dữ liệu mà bạn đã tạo trong quá trình thiết lập:
Trường
Thay thế bằng
PROJECT_ID
Mã dự án trên Cloud.
SERVICE_ACCOUNT_EMAIL_ADDRESS
Địa chỉ email của một tài khoản dịch vụ mà bạn đã tạo bằng vai trò Quản trị viên. Hãy xem bài viết Các vai trò của tài khoản dịch vụ di động để biết thông tin chi tiết.
VEHICLE_ID
HOẶC
DELIVERY_VEHICLE_ID
Mã nhận dạng ngẫu nhiên của xe. Mã nhận dạng có thể chứa tối đa 64 ký tự.
Sử dụng tiện ích gcloud để đăng nhập vào tài khoản Google Cloud và đặt dự án đang hoạt động trên máy trạm của bạn:
gcloudauthlogin
gcloudconfigsetprojectPROJECT_ID
Tạo một xác nhận quyền sở hữu JSON Web Token (JWT) để tạo xe:
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eThis guide provides instructions to verify your Fleet Engine authorization and create a trial vehicle using the \u003ccode\u003egcloud\u003c/code\u003e command line utility.\u003c/p\u003e\n"],["\u003cp\u003eYou will need your Cloud project ID, service account email address, and a unique vehicle ID to complete the verification process.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves generating and signing a JWT, then using it to create a test vehicle via a \u003ccode\u003ecurl\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful setup is indicated by the output displaying the name of the created vehicle (e.g., "providers/PROJECT_ID/vehicles/VEHICLE_ID").\u003c/p\u003e\n"],["\u003cp\u003eFleet Engine automatically purges inactive vehicles after 7 days, eliminating the need for manual deletion.\u003c/p\u003e\n"]]],[],null,["# Verify your setup\n\nThis guide helps you verify that your Fleet Engine authorization setup is\ncomplete, and that you can create a trial vehicle. This guide uses\n[the `gcloud` command line utility](https://cloud.google.com/sdk/gcloud) to test\nauthorization token signing and vehicle creation.\n\nTo complete this process, do the following:\n\n1. Replace the fields below with the data you created as part of the setup:\n\n| Field | Replace with |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| \u003cvar class=\"edit\" scope=\"PROJECT_ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e | Your Cloud project ID. |\n| \u003cvar class=\"edit\" scope=\"SERVICE_ACCOUNT_EMAIL_ADDRESS\" translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL_ADDRESS\u003c/var\u003e | The email address of a service account you've created with the Admin role. See [Mobility service account roles](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts#mobility_service_account_roles) for details. |\n| \u003cvar class=\"edit\" scope=\"VEHICLE_ID\" translate=\"no\"\u003eVEHICLE_ID\u003c/var\u003e **OR** \u003cvar class=\"edit\" scope=\"DELIVERY_VEHICLE_ID\" translate=\"no\"\u003eDELIVERY_VEHICLE_ID\u003c/var\u003e | A random ID for the vehicle. The ID can contain a maximum of 64 characters. |\n\n1. Use the `gcloud` utility to log into the Google Cloud account and set the\n active project on your workstation:\n\n gcloud auth login\n gcloud config set project \u003cvar label=\"project ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n2. Create a JSON Web Token (JWT) claim for the vehicle creation:\n\n ### On-demand trips\n\n ```\n cat \u003e claim.jwt \u003c\u003c EOM\n {\n \"iss\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"sub\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"aud\": \"https://fleetengine.googleapis.com/\",\n \"iat\": $(date +%s),\n \"exp\": $((`date +%s` + 3600)),\n \"authorization\": {\n \"vehicleid\": \"VEHICLE_ID\"\n }\n }\n EOM\n \n ```\n\n ### Scheduled tasks\n\n ```\n cat \u003e claim.jwt \u003c\u003c EOM\n {\n \"iss\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"sub\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"aud\": \"https://fleetengine.googleapis.com/\",\n \"iat\": $(date +%s),\n \"exp\": $((`date +%s` + 3600)),\n \"authorization\": {\n \"deliveryvehicleid\": \"DELIVERY_VEHICLE_ID\"\n }\n }\n EOM\n \n ```\n3. Use `gcloud` to sign this JWT with the appropriate IAM permissions. :\n\n gcloud iam service-accounts sign-jwt claim.jwt output.jwt \\\n --iam-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL_ADDRESS\u003c/var\u003e\n\n The signed JWT is stored in `output.jwt`.\n\n For details, see [Provide required permissions](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#permissions-access) and\n [the `gcloud` command line guide](https://cloud.google.com/sdk/gcloud/reference/beta/iam/service-accounts/sign-jwt) in the Google Cloud\n documentation.\n4. Use `curl` to create a test vehicle on Fleet Engine:\n\n ### On-demand trips\n\n ```\n curl -X POST \"https://fleetengine.googleapis.com/v1/providers/PROJECT_ID/vehicles?vehicleId=VEHICLE_ID\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer $(cat output.jwt)\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"name\": \"providers/PROJECT_ID/vehicles/VEHICLE_ID\"\n }\n EOM\n {\n \"vehicleState\": \"OFFLINE\",\n \"supportedTripTypes\": [\"EXCLUSIVE\"],\n \"maximumCapacity\": 4,\n \"vehicleType\": {\"category\": \"AUTO\"},\n \"attributes\": [{\"key\": \"on_trip\", \"value\": \"false\"}]\n }\n \n ```\n\n This command should print the name of the vehicle as output. If you\n see the following text, your setup is successful. \n\n ```\n {\n \"name\": \"providers/PROJECT_ID/vehicles/VEHICLE_ID\"\n }\n \n ```\n\n ### Scheduled tasks\n\n ```\n curl -X POST \"https://fleetengine.googleapis.com/v1/providers/PROJECT_ID/deliveryVehicles?deliveryVehicleId=DELIVERY_VEHICLE_ID\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer $(cat output.jwt)\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"name\": \"providers/PROJECT_ID/deliveryVehicles/DELIVERY_VEHICLE_ID\"\n }\n EOM\n \n ```\n\n This command should print the name of the delivery vehicle as output. If you\n see the following text, your setup is successful. \n\n ```\n {\n \"name\": \"providers/PROJECT_ID/deliveryVehicles/DELIVERY_VEHICLE_ID\"\n }\n \n ```\n | **Note:** Fleet Engine automatically purges all entities (including vehicles) after 7 days of inactivity, such as updates.\n\nWhat's next\n-----------\n\n- [Troubleshoot common issues](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/troubleshoot)\n- [Create and use vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles)"]]