संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Google API को सुरक्षित तरीके से कॉल करने के लिए, वेब ऐप्लिकेशन को ऐक्सेस टोकन लेना होगा.
Google Identity Services की JavaScript लाइब्रेरी, उपयोगकर्ता के साइन इन के लिए पुष्टि करने और Google API के साथ इस्तेमाल करने के लिए, ऐक्सेस टोकन पाने की अनुमति, दोनों का इस्तेमाल करती है. लाइब्रेरी सिर्फ़ ब्राउज़र में इस्तेमाल करने के लिए बनाई गई है.
पुष्टि करने से यह तय होता है कि कोई व्यक्ति कौन है. आम तौर पर, इसे उपयोगकर्ता साइन-अप या साइन इन कहा जाता है. डेटा या संसाधनों का ऐक्सेस देने या न देने की प्रोसेस को ऑथराइज़ेशन कहते हैं. इसमें, उपयोगकर्ता की सहमति लेने और उसे मैनेज करने, स्कोप के साथ शेयर किए गए डेटा या संसाधनों की संख्या को सीमित करना, और Google API के साथ इस्तेमाल करने के लिए ऐक्सेस टोकन पाना शामिल है.
इन गाइड में, अनुमति देने और डेटा शेयर करने से जुड़े विषयों के बारे में बताया गया है.
उपयोगकर्ता की अनुमति कैसे काम करती है, इसमें उपयोगकर्ता को अनुमति देने के अलग-अलग चरणों के बारे में पूरी जानकारी दी गई है. साथ ही, इसमें उपयोगकर्ता डायलॉग के उदाहरण भी शामिल हैं.
अगर आपको पुष्टि करने और उपयोगकर्ता के लिए साइन अप और साइन इन करने की प्रोसेस लागू करने का तरीका जानना है, तो Google से साइन इन करें देखें.
इस लाइब्रेरी को Node.js जैसे सर्वर-साइड JavaScript फ़्रेमवर्क के साथ इस्तेमाल नहीं किया जा सकता. इसके बजाय, Google की Node.js क्लाइंट लाइब्रेरी का इस्तेमाल करें.
क्या बदलाव हुए हैं
उपयोगकर्ताओं के लिए, Google Identity Services लाइब्रेरी की मदद से, पहले की JavaScript लाइब्रेरी की तुलना में, उपयोगिता से जुड़े कई सुधार किए गए हैं. इनमें ये शामिल हैं:
उपयोगकर्ता के साइन-इन की पुष्टि और Google API को कॉल करने के लिए ऐक्सेस टोकन पाने की अनुमति देने की प्रक्रिया में अब दो अलग-अलग और अलग-अलग यूज़र फ़्लो हैं. एक, साइन-इन के लिए और दूसरा, अनुमति देने के दौरान सहमति के लिए. ऐप्लिकेशन आपकी और आपकी पहचान के बारे में साफ़ तौर पर पता लगाने के लिए, अलग-अलग यूज़र फ़्लो है.
उपयोगकर्ता की सहमति के दौरान, डेटा शेयर करने की बेहतर पारदर्शिता और कंट्रोल.
ब्राउज़र पर आधारित पॉप-अप डायलॉग. इनकी मदद से, कॉन्टेंट के बीच में आने वाली रुकावट को कम किया जाता है. इससे लोगों को आपकी साइट से बाहर निकलने की ज़रूरत नहीं पड़ती:
Google से ऐक्सेस टोकन लेना या
अपने बैकएंड प्लैटफ़ॉर्म पर एक ऑथराइज़ेशन कोड भेजें.
डेवलपर के लिए, हमारा फ़ोकस है जटिलता को कम करना, सुरक्षा को बेहतर बनाना, और आपके इंटिग्रेशन को ज़्यादा से ज़्यादा तेज़ और आसान बनाना. इनमें से कुछ बदलाव यहां दिए गए हैं:
साइन इन करने के लिए उपयोगकर्ता की पुष्टि और Google API को कॉल करने के लिए, ऐक्सेस टोकन पाने के लिए इस्तेमाल किए जाने वाले अनुमति देना, JavaScript ऑब्जेक्ट और तरीकों के दो अलग-अलग सेट हैं. इससे पुष्टि करने या अनुमति देने की प्रक्रिया को लागू करने के लिए,
जानकारी की ज़रूरत और जटिलता कम हो जाती है.
एक JavaScript लाइब्रेरी अब इन दोनों के साथ काम करती है:
OAuth 2.0 इंप्लिसिट फ़्लो, इसका इस्तेमाल ब्राउज़र में इस्तेमाल करने के लिए, ऐक्सेस टोकन पाने के लिए किया जाता है
OAuth 2.0 के ऑथराइज़ेशन कोड फ़्लो को ऑफ़लाइन ऐक्सेस भी कहा जाता है. यह आपके बैकएंड प्लैटफ़ॉर्म पर सुरक्षित तरीके से एक ऑथराइज़ेशन कोड डिलीवर करता है. इसकी जगह पर, ऐक्सेस टोकन और रीफ़्रेश टोकन बदला जा सकता है. पहले, ये फ़्लो सिर्फ़ एक से ज़्यादा लाइब्रेरी का इस्तेमाल करके और OAuth 2.0 एंडपॉइंट पर सीधे कॉल करके उपलब्ध थे. एक ही लाइब्रेरी से इंटिग्रेशन में लगने वाला समय और मेहनत कम हो जाती है. इससे कई लाइब्रेरी और OAuth 2.0 के कॉन्सेप्ट को शामिल करने और सीखने के बजाय, एक यूनिफ़ाइड इंटरफ़ेस पर फ़ोकस किया जा सकता है.
आसानी और पढ़ने में आसान होने के लिए, गैटर स्टाइल फ़ंक्शन से जुड़े दिशा-निर्देशों को हटा दिया गया है.
अनुमति वाले जवाबों को मैनेज करते समय, यह चुना जाता है कि अनुरोधों को पूरा करने के लिए
प्रॉमिस का इस्तेमाल किया जाए या नहीं.
gapi.auth2 मॉड्यूल और उससे जुड़े ऑब्जेक्ट और तरीके, अब आपके लिए अपने-आप लोड नहीं होंगे. इन्हें Google Identity Services की लाइब्रेरी के ऑब्जेक्ट और तरीकों से, ज़्यादा साफ़ तौर पर बदल दिया गया है.
उपयोगकर्ता की सुरक्षा और जागरूकता बढ़ाने के लिए, जिन ऐक्सेस टोकन की समयसीमा खत्म हो चुकी है उनके अपने-आप रीफ़्रेश होने की सुविधा को हटा दिया गया है. ऐक्सेस टोकन की समयसीमा खत्म होने के बाद, आपके ऐप्लिकेशन को Google API से जुड़ी गड़बड़ियों को ठीक करने के साथ-साथ, नए और मान्य ऐक्सेस टोकन का अनुरोध भी करना होगा.
पुष्टि करने और अनुमति देने से जुड़े पलों को साफ़ तौर पर अलग-अलग दिखाने के लिए, अब ऐक्सेस टोकन जारी करने के साथ-साथ आपके ऐप्लिकेशन और Google खाते में उपयोगकर्ता के साइन इन करने की सुविधा भी काम नहीं करती. इससे पहले, ऐक्सेस टोकन का अनुरोध करने पर उपयोगकर्ताओं ने अपने Google खाते में साइन इन भी किया था. साथ ही, उपयोगकर्ता की पुष्टि के लिए, JWT आईडी टोकन क्रेडेंशियल भी दिया था.
उपयोगकर्ता की सुरक्षा और निजता बढ़ाने के लिए, अनुमति के लिए जारी किए गए हर उपयोगकर्ता के क्रेडेंशियल में, कम से कम अधिकार का सिद्धांत अपनाया जाता है. इसके लिए, सिर्फ़ एक ऐक्सेस टोकन और उसे मैनेज करने के लिए ज़रूरी जानकारी शामिल की जाती है.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2023-12-01 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eGoogle Identity Services JavaScript library enables secure access to Google APIs via access tokens and supports user authentication.\u003c/p\u003e\n"],["\u003cp\u003eThe library offers separate, streamlined user flows for sign-in (authentication) and consent (authorization) for enhanced user experience and control.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers benefit from reduced complexity, improved security, and easier integration with features like a unified library for both implicit and authorization code flows.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Identity Services prioritizes user privacy and security through measures like least privilege credentials and explicit access token refresh handling.\u003c/p\u003e\n"],["\u003cp\u003eThe library is exclusively for browser-based applications and should not be used with server-side JavaScript frameworks like Node.js.\u003c/p\u003e\n"]]],[],null,["# Authorizing for Web\n\nWeb apps must obtain an access token to securely call Google APIs.\n\nThe Google Identity Services JavaScript library supports both authentication for\nuser sign-in and authorization to obtain an access token for use with Google\nAPIs. The library is intended only for use in browsers.\n\nAuthentication establishes who someone is, and is commonly referred to as user\nsign-up or sign-in. Authorization is the process of granting or rejecting access\nto data or resources. It includes obtaining and managing user consent, limiting\nthe amount of data or resources shared with scopes, and retrieving an access\ntoken for use with Google APIs.\n\nThese guides cover authorization and data sharing topics.\n\n[How user authorization works](/identity/oauth2/web/guides/how-user-authz-works) describes the individual steps of user\nauthorization in detail and includes user dialog examples.\n\nIf you are looking for help with authentication and how to implement user\nsign-up and sign-in see [Sign In With Google](/identity/gsi/web/guides/overview).\n| **Note:** The `email`, `profile`, and `openid` scopes are used for user authentication. If your app only uses these scopes [Sign In With Google](/identity/gsi/web) is recommended instead.\n\nThis library is not intended for use with server-side JavaScript frameworks such\nas Node.js, instead use Google's [Node.js](https://github.com/googleapis/google-api-nodejs-client)\nclient library.\n\nWhat's changed\n--------------\n\nFor users, the Google Identity Services library offers numerous usability\nimprovements over earlier JavaScript libraries, including:\n\n- Authentication for user sign-in, and authorization to obtain an access token to call Google APIs, now have two separate and distinct user flows; one for [sign-in](/identity/gsi/web/guides/overview#how_it_works) and another for [consent](/identity/oauth2/web/guides/how-user-authz-works#user_consent) during authorization, with separate user flows to clearly differentiate who you are, from what an app can do.\n- Improved visibility and granular control of data sharing during [user\n consent](/identity/oauth2/web/guides/how-user-authz-works#user_consent).\n- Browser based pop-up dialogs to reduce friction, and which do not require users to leave your site to:\n - obtain an access token from Google, or\n - send an authorization code to your backend platform.\n\nFor developers, our focus has been to reduce complexity, improve security, and\nmake your integration as quick and easy as possible. Some of these changes are:\n\n- User [authentication](/identity/gsi/web/reference/js-reference) for sign-in, and [authorization](/identity/oauth2/web/reference/js-reference) used to obtain an access token to call Google APIs, are two separate and distinct sets of JavaScript objects, and methods. This reduces the complexity and amount of detail required to implement authentication or authorization.\n- A single JavaScript library now supports both the:\n - OAuth 2.0 implicit flow, used to obtain an access token for use in-browser\n - OAuth 2.0 authorization code flow, also known as offline access, and initiates securely delivering an authorization code to your backend platform, where it can be exchanged for an access token and refresh token. Previously, these flows were only available by using multiple libraries and through direct calls to OAuth 2.0 endpoints. A single library decreases your integration time and effort, instead of including and learning multiple libraries and OAuth 2.0 concepts you can focus on a single, unified interface.\n- Indirection through getter style functions has been removed for simplicity and readability.\n- When handling authorization responses you choose whether or not to use a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) to fulfill requests, instead of that decision being made for you.\n- The [Google API Client Library for JavaScript](https://github.com/google/google-api-javascript-client) has been updated with these changes:\n - the `gapi.auth2` module and associated objects and methods are no longer automatically loaded for you behind the scenes, and have been replaced with more explicit Google Identity Services library objects and methods.\n - Automatic refresh of expired access tokens has been removed to improve user security and awareness. After an access token expires your app must handle Google API error responses, request, and obtain a new, valid access token.\n - To support a clear separation of authentication and authorization moments, simultaneously signing a user in to your app and to their Google Account while also issuing an access token is no longer supported. Previously, requesting an access token also signed users into their Google Account and returned a JWT ID token credential for user authentication.\n- To increase user security and privacy, per user [credentials](/identity/oauth2/web/guides/migration-to-gis#example_credentials) issued for authorization follow the principle of least privilege by including only an access token and information required to manage it."]]