JSON ওয়েব টোকেন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি JSON ওয়েব টোকেন (JWT) হল একটি ওপেন ওয়েব স্ট্যান্ডার্ড যা একটি ক্লায়েন্ট এবং সার্ভারের মধ্যে তথ্য আদান-প্রদানের প্রমাণীকরণ এবং অনুমোদনের জন্য ব্যবহৃত হয়। যখন একজন অ্যাপ ব্যবহারকারী উপযুক্ত ভূমিকার শংসাপত্রের সাথে প্রথম সাইন ইন করেন, তখন সার্ভার পরবর্তী অনুরোধের সাথে ব্যবহারের জন্য একটি এনকোডেড, ডিজিটালি-সাইন করা JWT তৈরি করে এবং ফেরত দেয়। এই প্রক্রিয়া উভয়ই ব্যবহারকারীকে প্রমাণীকরণ করে এবং তাদের অ্যাকাউন্টের ভূমিকার উপর ভিত্তি করে রুট, পরিষেবা এবং সংস্থান অ্যাক্সেস করার অনুমতি দেয়।
ফ্লিট ইঞ্জিনের জন্য JSON ওয়েব টোকেন ব্যবহার করতে হবে (JWTs) স্বল্প-বিশ্বাসের পরিবেশ থেকে API পদ্ধতি কলের জন্য: স্মার্টফোন এবং ব্রাউজার।
একটি JWT আপনার সার্ভারে উদ্ভূত হয়, স্বাক্ষরিত হয়, এনক্রিপ্ট করা হয় এবং পরবর্তী সার্ভার ইন্টারঅ্যাকশনের জন্য ক্লায়েন্টের কাছে পাঠানো হয় যতক্ষণ না এটি মেয়াদ শেষ হয় বা আর বৈধ না হয়।
মূল বিবরণ
API কীগুলির বিপরীতে, JWT গুলি স্বল্পস্থায়ী এবং শুধুমাত্র সেইগুলির মধ্যেই সীমাবদ্ধ যা ভূমিকা সম্পাদন করার জন্য অনুমোদিত। JWTs সম্পর্কে আরও তথ্যের জন্য, উইকিপিডিয়াতে JSON ওয়েব টোকেন দেখুন। অ্যাক্সেসের ভূমিকা সম্পর্কে বিস্তারিত জানার জন্য, এই নির্দেশিকায় পরিষেবা অ্যাকাউন্টের ভূমিকা দেখুন।
JWT উপাদান
JWT-এ একটি শিরোনাম এবং একটি দাবি বিভাগ থাকে। হেডার বিভাগে পরিষেবা অ্যাকাউন্ট থেকে প্রাপ্ত ব্যক্তিগত কী এবং এনক্রিপশন অ্যালগরিদমের মতো তথ্য রয়েছে। দাবি বিভাগে তথ্য রয়েছে যেমন JWT-এর তৈরির সময়, বেঁচে থাকার সময়, JWT যে পরিষেবাগুলিতে অ্যাক্সেস দাবি করে এবং সুযোগ অ্যাক্সেসের জন্য অন্যান্য অনুমোদনের তথ্য; উদাহরণস্বরূপ, ডেলিভারি গাড়ির আইডি।
নিম্নলিখিত সারণীটি সাধারণভাবে JWT ক্ষেত্রগুলির সম্পর্কে বর্ণনামূলক বিবরণ প্রদান করে, সেইসাথে আপনার ফ্লিট ইঞ্জিন ক্লাউড প্রকল্পে আপনি এই ক্ষেত্রগুলির মানগুলি কোথায় পাবেন সে সম্পর্কে নির্দিষ্ট তথ্য প্রদান করে৷
JWT হেডার ক্ষেত্র মাঠ | বর্ণনা |
---|
alg | ব্যবহার করার জন্য অ্যালগরিদম। `RS256`। |
টাইপ | টোকেনের ধরন। `JWT`। |
বাচ্চা | আপনার পরিষেবা অ্যাকাউন্টের ব্যক্তিগত কী আইডি। আপনি আপনার পরিষেবা অ্যাকাউন্ট JSON ফাইলের private_key_id ক্ষেত্রে এই মানটি খুঁজে পেতে পারেন। সঠিক স্তরের অনুমতি সহ একটি পরিষেবা অ্যাকাউন্ট থেকে একটি কী ব্যবহার করা নিশ্চিত করুন৷ |
JWT ক্ষেত্র দাবি করে মাঠ | বর্ণনা |
---|
iss | আপনার পরিষেবা অ্যাকাউন্টের ইমেল ঠিকানা, আপনার পরিষেবা অ্যাকাউন্ট JSON ফাইলের client_email ক্ষেত্রে পাওয়া যায়৷ |
উপ | আপনার পরিষেবা অ্যাকাউন্টের ইমেল ঠিকানা, আপনার পরিষেবা অ্যাকাউন্ট JSON ফাইলের client_email ক্ষেত্রে পাওয়া যায়৷ |
aud | আপনার পরিষেবা অ্যাকাউন্টের SERVICE_NAME , এই ক্ষেত্রে https://fleetengine.googleapis.com/ |
iat | টাইমস্ট্যাম্প যখন JWT তৈরি করা হয়েছিল, 00:00:00 UTC, January 1, 1970 থেকে অতিবাহিত সেকেন্ডে নির্দিষ্ট করা হয়েছে। তির্যক জন্য 10 মিনিট অনুমতি দিন। যদি টাইমস্ট্যাম্প অতীতে বা ভবিষ্যতে অনেক দূরে হয়, সার্ভার একটি ত্রুটি রিপোর্ট করতে পারে। |
exp | টাইমস্ট্যাম্প যখন JWT মেয়াদ শেষ হয়, 00:00:00 UTC, January 1, 1970 থেকে অতিবাহিত সেকেন্ডে নির্দিষ্ট করা হয়। টাইমস্ট্যাম্প ভবিষ্যতে এক ঘণ্টার বেশি হলে অনুরোধটি ব্যর্থ হয়। |
অনুমোদন | ব্যবহারের ক্ষেত্রে নির্ভর করে, deliveryvehicleid , trackingid , taskid বা taskids থাকতে পারে। টাস্কিড নির্দিষ্ট করলে, অনুমোদনের সুযোগ অবশ্যই নিম্নলিখিত ফর্মগুলির মধ্যে একটিতে একটি অ্যারে হতে হবে: "taskids": ["task_id_one","task_id_two"] বা "taskids": ["*"] |
Fleet Engine JWT দাবি করেছে
ফ্লিট ইঞ্জিন ব্যক্তিগত দাবি ব্যবহার করে। ব্যক্তিগত দাবি ব্যবহার করা নিশ্চিত করে যে শুধুমাত্র অনুমোদিত ক্লায়েন্টরা তাদের নিজস্ব ডেটা অ্যাক্সেস করতে পারে।
উদাহরণস্বরূপ, যখন আপনার সার্ভার ড্রাইভারের মোবাইল ডিভাইসের জন্য একটি JSON ওয়েব টোকেন ইস্যু করে, তখন এতে ড্রাইভারের গাড়ির আইডির মান সহ vehicleid
দাবি বা deliveryvehicleid
দাবি থাকা উচিত। তারপরে, ড্রাইভারের ভূমিকার উপর নির্ভর করে, JWTs শুধুমাত্র নির্দিষ্ট গাড়ির আইডির জন্য অ্যাক্সেস সক্ষম করে এবং অন্য কোনো নির্বিচারে গাড়ির আইডি নয়।
ফ্লিট ইঞ্জিন নিম্নলিখিত ব্যক্তিগত দাবি ব্যবহার করে:
অন-ডিমান্ড ট্রিপ
-
vehicleid
- ড্রাইভার SDK সর্বদা এই দাবিটি ব্যবহার করে, ভ্রমণে বা যানবাহনে পরিচালনা করা হোক না কেন। ফ্লিট ইঞ্জিন ব্যাকএন্ড নিশ্চিত করে যে পরিবর্তন করার আগে গাড়িটি অনুরোধ করা ট্রিপের সাথে যুক্ত।
- JWT যানবাহন এবং ট্রিপ অপারেশন উভয়ই কভার করতে পারে, এমনকি প্রয়োজন না হলেও, যা JWT স্বাক্ষর বাস্তবায়নকে সহজ করতে পারে।
-
tripid
:- ভোক্তা SDK সর্বদা এই দাবিটি ব্যবহার করে।
- JWT যানবাহন এবং ট্রিপ অপারেশন উভয়ই কভার করতে পারে, এমনকি প্রয়োজন না হলেও, যা টোকেন স্বাক্ষর বাস্তবায়নকে সহজ করতে পারে।
নির্ধারিত কাজ
deliveryvehicleid
প্রতি-ডেলিভারি-গাড়ি API কল করার সময় ব্যবহার করুন।
taskid
প্রতি টাস্ক API কল করার সময় ব্যবহার করুন।
taskids
BatchCreateTasksAPI
কল করার সময় ব্যবহার করুন। এই দাবিটি অবশ্যই অ্যারে আকারে হতে হবে এবং অ্যারেতে অনুরোধটি সম্পূর্ণ করার জন্য প্রয়োজনীয় সমস্ত টাস্ক আইডি থাকা উচিত৷ delivervehicleid
, trackingid
, বা taskid
দাবি অন্তর্ভুক্ত করবেন না৷
trackingid
GetTaskTrackingInfoAPI
কল করার সময় ব্যবহার করুন। অনুরোধে ট্র্যাকিং আইডির সাথে দাবি অবশ্যই মিলবে। delivervehicleid
, taskid
, বা taskids
দাবি অন্তর্ভুক্ত করবেন না৷
এরপর কি
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eJSON Web Tokens (JWTs) are required for API calls to Fleet Engine from low-trust environments like smartphones and browsers, providing authentication and authorization.\u003c/p\u003e\n"],["\u003cp\u003eJWTs are digitally signed by a service account on your server, a trusted environment, and passed to the client for secure communication with Fleet Engine.\u003c/p\u003e\n"],["\u003cp\u003eJWTs contain header and claim sections with information about the private key, encryption algorithm, token lifespan, and authorized access scopes like vehicle or trip IDs.\u003c/p\u003e\n"],["\u003cp\u003eFleet Engine utilizes private claims within JWTs to ensure data security and limit access to specific resources based on assigned roles and vehicle or task IDs.\u003c/p\u003e\n"],["\u003cp\u003eUnlike API keys, JWTs are short-lived and restrict operations to those permitted by the associated service account role, enhancing security.\u003c/p\u003e\n"]]],[],null,["# JSON Web Tokens\n\nA JSON Web Token (JWT) is an open web standard that's used for authenticating\nand authorizing information exchanges between a client and a server. When an app\nuser first signs in with the appropriate role credentials, the server creates\nand returns an encoded, digitally-signed JWT for use with subsequent requests.\nThis process both authenticates the user and authorizes them to access routes,\nservices, and resources based on their account role.\n\nFleet Engine requires the use of **JSON Web Tokens** (JWTs) for API method calls\nfrom **low-trust environments**: smartphones and browsers.\n\nA JWT originates on your server, is signed, encrypted, and passed to the client\nfor subsequent server interactions until it expires or is no longer valid.\n\n**Key details**\n\n- Use [Application Default Credentials](https://google.aip.dev/auth/4110) to authenticate and authorize against Fleet Engine.\n- Use an appropriate service account to sign JWTs. See [Fleet Engine serviceaccount](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts#fleet_engine_service_account_roles) roles in **Fleet Engine Basics**.\n\nUnlike API keys, JWTs are short lived and limit operations to only those that\nthe role is authorized to perform. For more information on JWTs, see\n[JSON Web Tokens](https://en.wikipedia.org/wiki/JSON_Web_Token) on Wikipedia. For detail on access roles, see\n[Service account roles](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts) in this guide.\n\nJWT elements\n------------\n\nJWTs contain a header and a claim section. The header section contains\ninformation such as the private key obtained from service accounts, and the\nencryption algorithm. The claim section contains information such as the JWT's\ncreate time, time to live, the services that the JWT claims\naccess to, and other authorization information to scope access; for\nexample, the delivery vehicle ID.\n\nThe following table provides descriptive details about JWT fields in general,\nas well as specific information about where you can find the values for these\nfields in your Fleet Engine Cloud project.\n\n| **Field** | **Description** |\n|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| alg | The algorithm to use. \\`RS256\\`. |\n| typ | The type of token. \\`JWT\\`. |\n| kid | Your service account's private key ID. You can find this value in the `private_key_id` field of your service account JSON file. Make sure to use a key from a service account with the correct level of permissions. |\n[JWT header fields]\n\n| **Field** | **Description** |\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| iss | Your service account's email address, found in the `client_email` field of your service account JSON file. |\n| sub | Your service account's email address, found in the `client_email` field of your service account JSON file. |\n| aud | Your service account's `SERVICE_NAME`, in this case `https://fleetengine.googleapis.com/` |\n| iat | The timestamp when the JWT was created, specified in seconds elapsed since 00:00:00 `UTC, January 1, 1970`. Allow 10 minutes for skew. If the timestamp is too far in the past, or in the future, the server might report an error. |\n| exp | The timestamp when the JWT expires, specified in seconds elapsed since `00:00:00 UTC, January 1, 1970`. The request fails if the timestamp is more than one hour in the future. |\n| authorization | Depending on the use case, may contain `deliveryvehicleid`, `trackingid`, `taskid`, or `taskids`. If specifying taskids, the authorization scope must be an array in one of the following forms: `\"taskids\": [\"task_id_one\",\"task_id_two\"]` or `\"taskids\": [\"*\"]` |\n[JWT claims fields]\n\n### Fleet Engine JWT claims\n\nFleet Engine uses private claims. Using private claims ensures that only\nauthorized clients can access their own data.\n\nFor example, when your server issues a JSON Web Token for a driver's mobile\ndevice, it should contain either the `vehicleid` claim or the\n`deliveryvehicleid` claim with the value of that driver's vehicle ID. Then,\ndepending on the driver role, JWTs enable access only for the specific vehicle\nID and not any other arbitrary vehicle ID.\n\nFleet Engine uses the following private claims: \n\n### On-demand trips\n\n- **`vehicleid`** :\n - The Driver SDK always uses this claim, whether operating on a trip or vehicle. The Fleet Engine backend assures that the vehicle is associated with the requested trip before doing the modification.\n - The JWT can cover both vehicle and trip operations, even if not required, which may simplify the JWT signing implementation.\n- **`tripid`** :\n - The Consumer SDK always uses this claim.\n - The JWT can cover both vehicle and trip operations, even if not required, which may simplify the token signing implementation.\n\n### Scheduled tasks\n\n- `deliveryvehicleid`\n\n Use when calling per-delivery-vehicle\n APIs.\n- `taskid`\n\n Use when calling per-task APIs.\n- `taskids`\n\n Use when calling\n `BatchCreateTasksAPI`. This claim must be in array form,\n and the array should contain all task IDs necessary to complete the\n request. Don't include `delivervehicleid`,\n `trackingid`, or `taskid` claims.\n- `trackingid`\n\n Use when calling the\n `GetTaskTrackingInfoAPI`. The claim must match the tracking\n ID in the request. Don't include `delivervehicleid`,\n `taskid`, or `taskids` claims.\n\nWhat's next\n-----------\n\n- Read about [Fleet Engine security design](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/security-design) to understand the complete authentication flow.\n- Learn how to [Issue JSON Web Tokens](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/issue-jwt) from your server."]]