OAuth লিঙ্কিং টাইপ দুটি ইন্ডাস্ট্রি স্ট্যান্ডার্ড OAuth 2.0 ফ্লো, অন্তর্নিহিত এবং অনুমোদন কোড প্রবাহ সমর্থন করে।
在隐式代码流程中,Google 会在用户浏览器中打开您的授权端点。成功登录后,系统会向 Google 返回长期访问令牌。现在,从 Google 助理向你的 Action 发送的每个请求中都包含此访问令牌。
在授权代码流程中,您需要两个端点:
- 授权端点,该端点负责向尚未登录的用户显示登录界面,并以短期授权代码的形式记录所请求的访问。
- 令牌交换端点,负责两种类型的交换:
- 将授权代码交换为长期刷新令牌和短期访问令牌。用户完成帐号关联流程后,系统会进行这种交换。
- 将长期刷新令牌换成短期访问令牌。Google 需要新访问令牌时,由于此令牌已过期,因此会进行此交换。
虽然隐式代码流程的实现更简单,但 Google 建议通过隐式流程发出的访问令牌永远不会过期,因为将令牌过期与隐式流程一起使用会强制用户再次关联其帐号。如果出于安全考虑需要令牌到期,强烈建议您考虑使用身份验证代码流程。
OAuth অ্যাকাউন্ট লিঙ্কিং কার্যকর করুন
প্রকল্পটি কনফিগার করুন
OAuth লিঙ্কিং ব্যবহার করার জন্য আপনার প্রকল্প কনফিগার করতে, এই পদক্ষেপগুলি অনুসরণ করুন:
- অ্যাকশন কনসোল খুলুন এবং আপনি যে প্রকল্পটি ব্যবহার করতে চান তা নির্বাচন করুন।
- বিকাশ ট্যাবে ক্লিক করুন এবং অ্যাকাউন্ট লিঙ্কিং নির্বাচন করুন।
- অ্যাকাউন্ট লিঙ্ক করার পাশের সুইচটি সক্ষম করুন।
- অ্যাকাউন্ট তৈরি বিভাগে, না নির্বাচন করুন, আমি শুধুমাত্র আমার ওয়েবসাইটে অ্যাকাউন্ট তৈরির অনুমতি দিতে চাই ।
লিঙ্কিং টাইপে , OAuth এবং ইমপ্লিসিট নির্বাচন করুন।

ক্লায়েন্ট তথ্যে :
- Google থেকে আসা অনুরোধগুলি শনাক্ত করতে Google-এ আপনার অ্যাকশন দ্বারা জারি করা ক্লায়েন্ট আইডিতে একটি মান বরাদ্দ করুন।
- আপনার অনুমোদন এবং টোকেন এক্সচেঞ্জ এন্ডপয়েন্টের জন্য URL গুলি সন্নিবেশ করুন৷
- Save এ ক্লিক করুন।
আপনার OAuth সার্ভার বাস্তবায়ন করুন
To support the OAuth 2.0 implicit flow, your service makes an authorization endpoint available by HTTPS. This endpoint is responsible for authenticating and obtaining consent from users for data access. The authorization endpoint presents a sign-in UI to your users that aren't already signed in and records consent to the requested access.
When your Action needs to call one of your service's authorized APIs, Google uses this endpoint to get permission from your users to call these APIs on their behalf.
A typical OAuth 2.0 implicit flow session initiated by Google has the following flow:
- Google opens your authorization endpoint in the user's browser. The user signs in if not signed in already, and grants Google permission to access their data with your API if they haven't already granted permission.
- Your service creates an access token and returns it to Google by redirecting the user's browser back to Google with the access token attached to the request.
- Google calls your service's APIs, and attaches the access token with each request. Your service verifies that the access token grants Google authorization to access the API and then completes the API call.
Handle authorization requests
When your Action needs to perform account linking via an OAuth 2.0 implicit flow, Google sends the user to your authorization endpoint with a request that includes the following parameters:
| Authorization endpoint parameters | |
|---|---|
client_id |
The client ID you assigned to Google. |
redirect_uri |
The URL to which you send the response to this request. |
state |
A bookkeeping value that is passed back to Google unchanged in the redirect URI. |
response_type |
The type of value to return in the response. For the OAuth 2.0 implicit
flow, the response type is always token. |
For example, if your authorization endpoint is available at https://myservice.example.com/auth,
a request might look like:
GET https://myservice.example.com/auth?client_id=GOOGLE_CLIENT_ID&redirect_uri=REDIRECT_URI&state=STATE_STRING&response_type=token
For your authorization endpoint to handle sign-in requests, do the following steps:
Verify the
client_idandredirect_urivalues to prevent granting access to unintended or misconfigured client apps:- Confirm that the
client_idmatches the client ID you assigned to Google. - Confirm that the URL specified by the
redirect_uriparameter has the following form: YOUR_PROJECT_ID is the ID found on the Project settings page of the Actions Console.https://oauth-redirect.googleusercontent.com/r/YOUR_PROJECT_ID
- Confirm that the
Check if the user is signed in to your service. If the user isn't signed in, complete your service's sign-in or sign-up flow.
Generate an access token that Google will use to access your API. The access token can be any string value, but it must uniquely represent the user and the client the token is for and must not be guessable.
Send an HTTP response that redirects the user's browser to the URL specified by the
redirect_uriparameter. Include all of the following parameters in the URL fragment:access_token: the access token you just generatedtoken_type: the stringbearerstate: the unmodified state value from the original request The following is an example of the resulting URL:https://oauth-redirect.googleusercontent.com/r/YOUR_PROJECT_ID#access_token=ACCESS_TOKEN&token_type=bearer&state=STATE_STRING
Google's OAuth 2.0 redirect handler will receive the access token and confirm
that the state value hasn't changed. After Google has obtained an
access token for your service, Google will attach the token to subsequent calls
to your Action as part of the AppRequest.
প্রমাণীকরণ প্রবাহের জন্য ভয়েস ইউজার ইন্টারফেস ডিজাইন করুন
ব্যবহারকারী যাচাই করা হয়েছে কিনা তা পরীক্ষা করুন এবং অ্যাকাউন্ট লিঙ্কিং প্রবাহ শুরু করুন
- অ্যাকশন কনসোলে আপনার অ্যাকশন বিল্ডার প্রকল্পটি খুলুন।
- আপনার অ্যাকশনে অ্যাকাউন্ট লিঙ্ক করা শুরু করতে একটি নতুন দৃশ্য তৈরি করুন:
- দৃশ্যে ক্লিক করুন।
- একটি নতুন দৃশ্য যোগ করতে যোগ (+) আইকনে ক্লিক করুন।
- সদ্য নির্মিত দৃশ্যে, শর্তগুলির জন্য যোগ add আইকনে ক্লিক করুন।
- কথোপকথনের সাথে যুক্ত ব্যবহারকারী একজন যাচাইকৃত ব্যবহারকারী কিনা তা পরীক্ষা করে এমন একটি শর্ত যোগ করুন। চেক ব্যর্থ হলে, কথোপকথনের সময় আপনার অ্যাকশন অ্যাকাউন্ট লিঙ্কিং সম্পাদন করতে পারে না, এবং অ্যাকাউন্ট লিঙ্ক করার প্রয়োজন নেই এমন কার্যকারিতাগুলিতে অ্যাক্সেস প্রদানে ফিরে আসা উচিত।
- শর্তের অধীনে
Enter new expressionক্ষেত্রটিতে, নিম্নলিখিত যুক্তিটি লিখুন:user.verificationStatus != "VERIFIED" - ট্রানজিশনের অধীনে, এমন একটি দৃশ্য নির্বাচন করুন যার জন্য অ্যাকাউন্ট লিঙ্ক করার প্রয়োজন নেই বা এমন একটি দৃশ্য যা গেস্ট-অনলি কার্যকারিতার প্রবেশ বিন্দু।
- শর্তের অধীনে

- শর্তের জন্য অ্যাড add আইকনে ক্লিক করুন।
- ব্যবহারকারীর কোনো সংশ্লিষ্ট পরিচয় না থাকলে একটি অ্যাকাউন্ট লিঙ্কিং ফ্লো ট্রিগার করার জন্য একটি শর্ত যোগ করুন।
- শর্তের অধীনে
Enter new expressionক্ষেত্রটিতে, নিম্নলিখিত যুক্তিটি লিখুন::user.verificationStatus == "VERIFIED" - ট্রানজিশনের অধীনে, অ্যাকাউন্ট লিঙ্কিং সিস্টেম দৃশ্যটি নির্বাচন করুন।
- Save এ ক্লিক করুন।
- শর্তের অধীনে

সংরক্ষণ করার পরে, আপনার প্রকল্পে <SceneName>_AccountLinking নামে একটি নতুন অ্যাকাউন্ট লিঙ্কিং সিস্টেম দৃশ্য যোগ করা হয়েছে।
অ্যাকাউন্ট লিঙ্কিং দৃশ্য কাস্টমাইজ করুন
- দৃশ্যের অধীনে, অ্যাকাউন্ট লিঙ্কিং সিস্টেম দৃশ্য নির্বাচন করুন।
- সেন্ড প্রম্পটে ক্লিক করুন এবং ব্যবহারকারীকে বর্ণনা করতে একটি ছোট বাক্য যোগ করুন কেন অ্যাকশন তাদের পরিচয় অ্যাক্সেস করতে হবে (উদাহরণস্বরূপ "আপনার পছন্দগুলি সংরক্ষণ করতে")।
- Save এ ক্লিক করুন।

- শর্তের অধীনে, ব্যবহারকারী সফলভাবে অ্যাকাউন্ট লিঙ্কিং সম্পন্ন করলে ক্লিক করুন।
- ব্যবহারকারী যদি তাদের অ্যাকাউন্ট লিঙ্ক করতে সম্মত হন তবে কীভাবে প্রবাহটি চলবে তা কনফিগার করুন। উদাহরণ স্বরূপ, যেকোন কাস্টম বিজনেস লজিক প্রসেস করতে ওয়েবহুককে কল করুন এবং মূল দৃশ্যে ফিরে যেতে।
- Save এ ক্লিক করুন।

- শর্তের অধীনে, ব্যবহারকারী অ্যাকাউন্ট লিঙ্কিং বাতিল বা খারিজ করলে ক্লিক করুন।
- ব্যবহারকারী যদি তাদের অ্যাকাউন্ট লিঙ্ক করতে রাজি না হয় তবে কীভাবে প্রবাহটি চলবে তা কনফিগার করুন। উদাহরণস্বরূপ, একটি স্বীকৃতিমূলক বার্তা পাঠান এবং এমন দৃশ্যগুলিতে পুনঃনির্দেশ করুন যা কার্যকারিতা প্রদান করে যার জন্য অ্যাকাউন্ট লিঙ্ক করার প্রয়োজন নেই৷
- Save এ ক্লিক করুন।

- শর্তের অধীনে, সিস্টেম বা নেটওয়ার্ক ত্রুটি দেখা দিলে ক্লিক করুন।
- সিস্টেম বা নেটওয়ার্ক ত্রুটির কারণে অ্যাকাউন্ট লিঙ্কিং ফ্লো সম্পূর্ণ না হলে কীভাবে ফ্লো চলবে তা কনফিগার করুন। উদাহরণস্বরূপ, একটি স্বীকৃতিমূলক বার্তা পাঠান এবং এমন দৃশ্যগুলিতে পুনঃনির্দেশ করুন যা কার্যকারিতা প্রদান করে যার জন্য অ্যাকাউন্ট লিঙ্ক করার প্রয়োজন নেই৷
- Save এ ক্লিক করুন।
ডেটা অ্যাক্সেসের অনুরোধগুলি পরিচালনা করুন
অ্যাসিস্ট্যান্ট রিকোয়েস্টে যদি একটি অ্যাক্সেস টোকেন থাকে , তাহলে প্রথমে চেক করুন যে অ্যাক্সেস টোকেনটি বৈধ (এবং মেয়াদ শেষ হয়নি) এবং তারপর আপনার ডাটাবেস থেকে সংশ্লিষ্ট ব্যবহারকারী অ্যাকাউন্টটি পুনরুদ্ধার করুন।