আপনার ব্যাকএন্ড থেকে টোকেন ইস্যু
জয়েন টোকেন তৈরির সমর্থিত উপায় — এবং যে একটি ফিল্ড বাদ পড়লে সিঙ্গল-সেশন নিয়ন্ত্রণ নীরবে বন্ধ হয়ে যায়।
কেন ব্যাকএন্ড থেকে?
আপনার সার্ভার সিক্রেট কখনোই অ্যাপে যাবে না। APK-তে থাকা যেকোনো কী বের করে যে কারও পরিচয়ে সাজা সম্ভব।
ডিভাইসের তথ্য পাঠান
আপনার সার্ভার ডিভাইস দেখতে পায় না। অ্যাপ এগুলো আপনার সার্ভারে পাঠাবে, আর সার্ভার একই রিকোয়েস্টে আমাদের কাছে ফরোয়ার্ড করবে।
ব্যর্থতাটি নীরব
device_id ছাড়া এক-অ্যাকাউন্ট-এক-ডিভাইস কোনো এরর বা লগ ছাড়াই আগেভাগে ফিরে আসে। টোকেন সফল হয়, সুরক্ষা বন্ধ থাকে।
মাপা হয়েছে, অনুমান নয়
তিন ঘণ্টার বাস্তব জয়েনে: ব্যাকএন্ড-ইস্যু টোকেনে ৩,২২৪ জয়েন — ১০০% ডিভাইস আইডি ছাড়া। কিট-ইস্যু টোকেনে ১,৬৪১ জয়েন — ০%।
টোকেন রিকোয়েস্টের ফিল্ড
হেডারে সার্ভার সিক্রেট দিয়ে /api/v1/token-এ POST করুন।
| ফিল্ড | স্তর | অর্থ |
|---|---|---|
user_idstring | আবশ্যক | Who the token is for. Your own user id. (Previously `identity` — still accepted.) |
room_idstring | আবশ্যক | Which room they are joining. (Previously `room_name` — still accepted.) |
device_idstring | প্রস্তাবিত | A stable id for the PHYSICAL DEVICE — not the user, and not the session. This is what enforces one account on one device: when the same user_id joins from a different device_id, the previous device is messaged and removed. Omit it and that enforcement silently does nothing: the check returns early, logs nothing, and the old device stays signed in. |
device_modelstring | প্রস্তাবিত | e.g. SM-A175F. Feeds per-handset quality analysis — which models have audio or video trouble. |
osstring | প্রস্তাবিত | android | ios. |
os_versionstring | প্রস্তাবিত | e.g. 14. |
app_versionstring | প্রস্তাবিত | Your app's version, so a regression can be traced to a release. |
display_namestring | ঐচ্ছিক | Shown to other participants. Omit it and the name stays empty — we never substitute the user id for it. |
rolestring | ঐচ্ছিক | Only honoured from a server-signed request, and only while your project still carries the client-asserted-role exception. The supported path is PUT /rooms/:room/participants/:id/role. |
typestring | ঐচ্ছিক | audio_room | live_stream. Legacy kits send `service` (+ `kind`) instead and the type is derived. |
আপনার সার্ভারে
সিক্রেট কেবল এখানেই থাকে। চিহ্নিত ফিল্ডগুলো অ্যাপ থেকে আসে — সার্ভার নিজে থেকে জানতে পারে না।
// Your backend — the app never sees the server secret.
const res = await fetch("https://engine.udt-stream.com/api/v1/token", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-App-Secret": process.env.UTD_SERVER_SECRET, // never ship this in the app
},
body: JSON.stringify({
user_id: currentUser.id,
room_id: roomId,
// 🔴 Forwarded FROM THE APP. Your server cannot know these on its own,
// and without device_id one-account-one-device stops working for your users.
device_id: body.device_id,
device_model: body.device_model,
os: body.os,
os_version: body.os_version,
app_version: body.app_version,
}),
});আপনার অ্যাপে
ডিভাইসের তথ্য নিজের ব্যাকএন্ডে পাঠান, সে ফরোয়ার্ড করবে। ডিভাইস আইডি অ্যাপ রিস্টার্টেও একই থাকতে হবে।
// Your app — send the device facts to YOUR backend, which forwards them to us.
final deviceId = await MyDeviceIdentity.stableId(); // persisted, survives app restarts
await myApi.post("/rooms/$roomId/token", body: {
"device_id": deviceId,
"device_model": deviceInfo.model,
"os": Platform.isAndroid ? "android" : "ios",
"os_version": deviceInfo.version,
"app_version": packageInfo.version,
});প্রত্যাখ্যান কোড (403)
প্রতিটি প্রত্যাখ্যানে একটি code থাকে। কোড পড়ুন — কেবল প্রথমটিতেই "আপনাকে সরানো হয়েছে" দেখান।
| কোড | অর্থ | কী করবেন |
|---|---|---|
user_banned | This user is banned from this room. | Show them they were removed. This is the ONLY code that should produce that message. |
room_type_disabled | The project does not have this room type enabled. | A configuration problem, not a user problem. Never show a removal notice. |
streaming_disabled | The streaming service is not enabled for this project. | Same — configuration, not the user. |
appkey_identity_mint_disabled | You tried to mint an identity-bearing token with the publishable app_key. | Mint from your backend with the server secret instead. This is the path this page describes. |
অথ মোড
ইঞ্জিন প্রতিটি জয়েনে অথ মোড রেকর্ড করে, তাই আপনি যাচাই করতে পারবেন কোন পথে আছেন।
secret / signature / bearerYour backend, authenticated with your server secret. The recommended path.
app_keyThe device, using the publishable app key. The legacy path — being closed.
UTD দিয়ে গড়তে প্রস্তুত?
আপনার অ্যাকাউন্ট তৈরি করুন, মাস্টার ওয়ালেট ফান্ড করুন, এবং প্রয়োজনীয় সার্ভিসগুলো চালু করুন।