ওয়েব অ্যাপে SAML ব্যবহার করে প্রমাণীকরণ করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
আপনি যদি Firebase Authentication with Identity Platform আপগ্রেড করে থাকেন, তাহলে আপনি আপনার পছন্দের SAML পরিচয় প্রদানকারী ব্যবহার করে Firebase এর মাধ্যমে আপনার ব্যবহারকারীদের প্রমাণীকরণ করতে পারেন। এটি আপনার Firebase অ্যাপে ব্যবহারকারীদের সাইন ইন করতে আপনার SAML-ভিত্তিক SSO সমাধান ব্যবহার করা সম্ভব করে তোলে।
Firebase Authentication শুধুমাত্র পরিষেবা প্রদানকারীর সূচনা SAML প্রবাহকে সমর্থন করে।
আপনি শুরু করার আগে
SAML পরিচয় প্রদানকারী ব্যবহার করে ব্যবহারকারীদের সাইন ইন করতে, আপনাকে প্রথমে প্রদানকারীর কাছ থেকে কিছু তথ্য সংগ্রহ করতে হবে:
- প্রদানকারীর সত্তা আইডি : একটি URI যা পরিচয় প্রদানকারীকে শনাক্ত করে।
- প্রদানকারীর SAML SSO URL : পরিচয় প্রদানকারীর সাইন-ইন পৃষ্ঠার URL৷
- প্রদানকারীর সর্বজনীন কী শংসাপত্র : শংসাপত্রটি পরিচয় প্রদানকারীর স্বাক্ষরিত টোকেন যাচাই করতে ব্যবহৃত হয়।
- আপনার অ্যাপের সত্তা আইডি : একটি URI যা আপনার অ্যাপ, "পরিষেবা প্রদানকারী" সনাক্ত করে।
আপনার কাছে উপরের তথ্য পাওয়ার পরে, আপনার Firebase প্রকল্পের জন্য সাইন-ইন প্রদানকারী হিসাবে SAML সক্ষম করুন:
আপনার JavaScript প্রকল্পে Firebase যোগ করুন ।
আপনি যদি Firebase Authentication with Identity Platform আপগ্রেড না করে থাকেন তবে তা করুন৷ SAML প্রমাণীকরণ শুধুমাত্র আপগ্রেড করা প্রকল্পগুলিতে উপলব্ধ।
Firebase কনসোলের সাইন-ইন প্রদানকারী পৃষ্ঠায়, নতুন প্রদানকারী যোগ করুন ক্লিক করুন এবং তারপরে SAML এ ক্লিক করুন।
এই প্রদানকারীর একটি নাম দিন. যে প্রোভাইডার আইডি তৈরি হয়েছে তা নোট করুন: saml.example-provider
মত কিছু। আপনি যখন আপনার অ্যাপে সাইন-ইন কোড যোগ করবেন তখন আপনার এই আইডির প্রয়োজন হবে।
আপনার পরিচয় প্রদানকারীর সত্তা আইডি, SSO URL এবং সর্বজনীন কী শংসাপত্র নির্দিষ্ট করুন৷ এছাড়াও আপনার অ্যাপের (পরিষেবা প্রদানকারী) সত্তা আইডি উল্লেখ করুন। এই মানগুলি অবশ্যই আপনার প্রদানকারীর দ্বারা নির্ধারিত মানগুলির সাথে হুবহু মেলে৷
আপনার পরিবর্তন সংরক্ষণ করুন.
আপনি যদি ইতিমধ্যে আপনার অ্যাপের ডোমেন অনুমোদন না করে থাকেন, তাহলে Firebase কনসোলের প্রমাণীকরণ > সেটিংস পৃষ্ঠায় অনুমতি তালিকায় এটি যোগ করুন।
Firebase SDK দিয়ে সাইন-ইন ফ্লো পরিচালনা করুন
Firebase JavaScript SDK দিয়ে সাইন-ইন প্রবাহ পরিচালনা করতে, এই ধাপগুলি অনুসরণ করুন:
Firebase কনসোলে আপনি যে প্রোভাইডার আইডি পেয়েছেন সেটি ব্যবহার করে একটি SAMLAuthProvider
এর একটি উদাহরণ তৈরি করুন।
Web
import { SAMLAuthProvider } from "firebase/auth";
const provider = new SAMLAuthProvider('saml.example-provider');
Web
var provider = new firebase.auth.SAMLAuthProvider('saml.example-provider');
``
SAML প্রদানকারী অবজেক্ট ব্যবহার করে Firebase দিয়ে প্রমাণীকরণ করুন।
আপনি হয় ব্যবহারকারীকে প্রদানকারীর সাইন-ইন পৃষ্ঠায় পুনঃনির্দেশ করতে পারেন অথবা একটি পপ-আপ ব্রাউজার উইন্ডোতে সাইন-ইন পৃষ্ঠা খুলতে পারেন৷
পুনঃনির্দেশিত প্রবাহ
signInWithRedirect()
কল করে প্রদানকারীর সাইন-ইন পৃষ্ঠায় পুনঃনির্দেশ করুন :
Web
import { getAuth, signInWithRedirect } from "firebase/auth";
const auth = getAuth();
signInWithRedirect(auth, provider);
Web
firebase.auth().signInWithRedirect(provider);
ব্যবহারকারী সাইন-ইন সম্পূর্ণ করার পরে এবং আপনার অ্যাপে ফিরে আসার পরে, আপনি getRedirectResult()
কল করে সাইন-ইন ফলাফল পেতে পারেন।
Web
import { getAuth, getRedirectResult, SAMLAuthProvider } from "firebase/auth";
const auth = getAuth();
getRedirectResult(auth)
.then((result) => {
// User is signed in.
// Provider data available using getAdditionalUserInfo()
})
.catch((error) => {
// Handle error.
});
Web
firebase.auth().getRedirectResult()
.then((result) => {
// User is signed in.
// Provider data available in result.additionalUserInfo.profile,
// or from the user's ID token obtained from result.user.getIdToken()
// as an object in the firebase.sign_in_attributes custom claim.
})
.catch((error) => {
// Handle error.
});
পপ-আপ প্রবাহ
Web
import { getAuth, signInWithPopup, OAuthProvider } from "firebase/auth";
const auth = getAuth();
signInWithPopup(auth, provider)
.then((result) => {
// User is signed in.
// Provider data available in result.additionalUserInfo.profile,
// or from the user's ID token obtained from result.user.getIdToken()
// as an object in the firebase.sign_in_attributes custom claim.
})
.catch((error) => {
// Handle error.
});
Web
firebase.auth().signInWithPopup(provider)
.then((result) => {
// User is signed in.
// Provider data available in result.additionalUserInfo.profile,
// or from the user's ID token obtained from result.user.getIdToken()
// as an object in the firebase.sign_in_attributes custom claim.
})
.catch((error) => {
// Handle error.
});
ID টোকেন এবং UserInfo অবজেক্টে ব্যবহারকারীর ইমেল ঠিকানা থাকে শুধুমাত্র যদি এটি পরিচয় প্রদানকারীর SAML দাবির NameID
বৈশিষ্ট্যে প্রদান করা হয়:
<Subject>
<NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">test@email.com</NameID>
</Subject>
যদিও উপরের উদাহরণগুলি সাইন-ইন প্রবাহের উপর ফোকাস করে, আপনি linkWithRedirect()
এবং linkWithPopup()
ব্যবহার করে একটি SAML প্রদানকারীকে একটি বিদ্যমান ব্যবহারকারীর সাথে লিঙ্ক করতে একই প্যাটার্ন ব্যবহার করতে পারেন এবং reauthenticateWithRedirect()
এবং reauthenticateWithPopup()
দিয়ে একজন ব্যবহারকারীকে পুনরায় প্রমাণীকরণ করতে পারেন, যা সাম্প্রতিক লগইন প্রয়োজন এমন সংবেদনশীল ক্রিয়াকলাপের জন্য নতুন শংসাপত্র পুনরুদ্ধার করতে ব্যবহার করা যেতে পারে।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-08 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-08 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["If you've upgraded to Firebase Authentication with Identity Platform, you can authenticate your users with Firebase\nusing the SAML identity provider of your choice. This makes it possible to use\nyour SAML-based SSO solution to sign users in to your Firebase app.\n\nFirebase Authentication supports only the service-provider initiated SAML flow.\n\nBefore you begin\n\nTo sign in users using a SAML identity provider, you must first collect some\ninformation from the provider:\n\n- **The provider's Entity ID**: A URI that identifies the identity provider.\n- **The provider's SAML SSO URL**: The URL of the identity provider's sign-in page.\n- **The provider's public key certificate**: The certificate used to validate tokens signed by the identity provider.\n- **Your app's Entity ID**: A URI that identifies your app, the \"service provider\".\n\nAfter you have the above information, enable SAML as a sign-in provider for your\nFirebase project:\n\n1. [Add Firebase to your JavaScript project](/docs/web/setup).\n\n2. If you haven't upgraded to Firebase Authentication with Identity Platform, do so. SAML authentication is only\n available in upgraded projects.\n\n3. On the [**Sign-in providers**](//console.firebase.google.com/project/_/authentication/providers)\n page of the Firebase console, click **Add new provider** , and then click\n **SAML**.\n\n4. Give a name to this provider. Note the provider ID that's generated:\n something like `saml.example-provider`. You'll need this ID when you add\n sign-in code to your app.\n\n5. Specify your identity provider's entity ID, SSO URL, and public key\n certificate. Also specify the entity ID of your app (the service provider).\n These values must exactly match the values your provider assigned to you.\n\n6. Save your changes.\n\n7. If you haven't already authorized your app's domain, add it to the allow\n list on the [**Authentication \\\u003e Settings**](//console.firebase.google.com/project/_/authentication/settings)\n page of the Firebase console.\n\nHandle the sign-in flow with the Firebase SDK\n\nTo handle the sign-in flow with the Firebase JavaScript SDK, follow these\nsteps:\n\n1. Create an instance of an `SAMLAuthProvider` using the provider ID you got in\n the Firebase console.\n\n Web \n\n import { SAMLAuthProvider } from \"firebase/auth\";\n\n const provider = new SAMLAuthProvider('saml.example-provider');\n\n Web \n\n var provider = new firebase.auth.SAMLAuthProvider('saml.example-provider');\n ``\n\n\u003c!-- --\u003e\n\n1. Authenticate with Firebase using the SAML provider object.\n\n You can either redirect the user to the provider's sign-in page or open the\n sign-in page in a pop-up browser window.\n\n **Redirect flow**\n\n Redirect to the provider sign-in page by calling `signInWithRedirect()`: \n\n Web \n\n import { getAuth, signInWithRedirect } from \"firebase/auth\";\n\n const auth = getAuth();\n signInWithRedirect(auth, provider);\n\n Web \n\n firebase.auth().signInWithRedirect(provider);\n\n After the user completes sign-in and returns to your app, you can obtain the\n sign-in result by calling `getRedirectResult()`. \n\n Web \n\n import { getAuth, getRedirectResult, SAMLAuthProvider } from \"firebase/auth\";\n\n const auth = getAuth();\n getRedirectResult(auth)\n .then((result) =\u003e {\n // User is signed in.\n\n // Provider data available using getAdditionalUserInfo()\n })\n .catch((error) =\u003e {\n // Handle error.\n });\n\n Web \n\n firebase.auth().getRedirectResult()\n .then((result) =\u003e {\n // User is signed in.\n\n // Provider data available in result.additionalUserInfo.profile,\n // or from the user's ID token obtained from result.user.getIdToken()\n // as an object in the firebase.sign_in_attributes custom claim.\n })\n .catch((error) =\u003e {\n // Handle error.\n });\n\n **Pop-up flow**\n\n Web \n\n import { getAuth, signInWithPopup, OAuthProvider } from \"firebase/auth\";\n\n const auth = getAuth();\n signInWithPopup(auth, provider)\n .then((result) =\u003e {\n // User is signed in.\n\n // Provider data available in result.additionalUserInfo.profile,\n // or from the user's ID token obtained from result.user.getIdToken()\n // as an object in the firebase.sign_in_attributes custom claim.\n })\n .catch((error) =\u003e {\n // Handle error.\n });\n\n Web \n\n firebase.auth().signInWithPopup(provider)\n .then((result) =\u003e {\n // User is signed in.\n\n // Provider data available in result.additionalUserInfo.profile,\n // or from the user's ID token obtained from result.user.getIdToken()\n // as an object in the firebase.sign_in_attributes custom claim.\n })\n .catch((error) =\u003e {\n // Handle error.\n });\n\n The ID token and [UserInfo](/docs/reference/js/auth.userinfo#userinfoemail)\n object contains the user's email address only if it is provided in the\n `NameID` attribute of the SAML assertion from the identity provider: \n\n \u003cSubject\u003e\n \u003cNameID Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress\"\u003etest@email.com\u003c/NameID\u003e\n \u003c/Subject\u003e\n\n2. While the above examples focus on sign-in flows, you can use the same\n pattern to link a SAML provider to an existing user using\n `linkWithRedirect()` and `linkWithPopup()`, and re-authenticate a user with\n `reauthenticateWithRedirect()` and `reauthenticateWithPopup()`, which can be\n used to retrieve fresh credentials for sensitive operations that require\n recent login."]]