{"id":30417,"date":"2026-10-05T23:39:54","date_gmt":"2026-10-05T23:39:54","guid":{"rendered":"https:\/\/umang.pk\/2026\/10\/05\/api-%da%a9%db%8c-%d8%aa%d9%88%d8%ab%db%8c%d9%82-%d8%a7%d9%88%d8%b1-%d8%a7%d8%ac%d8%a7%d8%b2%d8%aa-%d9%85%db%8c%da%a9%d8%a7%d9%86%d8%b2%d9%85%d8%8c-%d9%b9%d8%b1%db%8c%da%88-%d8%a2%d9%81%d8%b3%d8%8c\/"},"modified":"2026-10-05T23:39:54","modified_gmt":"2026-10-05T23:39:54","slug":"api-%da%a9%db%8c-%d8%aa%d9%88%d8%ab%db%8c%d9%82-%d8%a7%d9%88%d8%b1-%d8%a7%d8%ac%d8%a7%d8%b2%d8%aa-%d9%85%db%8c%da%a9%d8%a7%d9%86%d8%b2%d9%85%d8%8c-%d9%b9%d8%b1%db%8c%da%88-%d8%a2%d9%81%d8%b3%d8%8c","status":"publish","type":"post","link":"https:\/\/umang.pk\/en_us\/2026\/10\/05\/api-%da%a9%db%8c-%d8%aa%d9%88%d8%ab%db%8c%d9%82-%d8%a7%d9%88%d8%b1-%d8%a7%d8%ac%d8%a7%d8%b2%d8%aa-%d9%85%db%8c%da%a9%d8%a7%d9%86%d8%b2%d9%85%d8%8c-%d9%b9%d8%b1%db%8c%da%88-%d8%a2%d9%81%d8%b3%d8%8c\/","title":{"rendered":"API \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u0627\u0648\u0631 \u0627\u062c\u0627\u0632\u062a: \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645\u060c \u0679\u0631\u06cc\u0688 \u0622\u0641\u0633\u060c \u0627\u0648\u0631 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u06d2 \u0637\u0631\u06cc\u0642\u0648\u06ba \u0645\u06cc\u06ba \u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0646\u06af \u06a9\u0627 \u06af\u06c1\u0631\u0627 \u063a\u0648\u0637\u06c1"},"content":{"rendered":"\n<div id=\"\">\n<p>\u06c1\u0631 API \u06a9\u06d2 \u067e\u0627\u0633 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u06a9\u0686\u06be \u0634\u06a9\u0644 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u0644\u06cc\u06a9\u0646 \u0633\u0646\u062f \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u0627 \u0627\u0648\u0631 \u0627\u0633\u06d2 \u062f\u0631\u0633\u062a \u06a9\u0631\u0646\u0627 \u062f\u0648 \u0628\u0627\u0644\u06a9\u0644 \u0645\u062e\u062a\u0644\u0641 \u0686\u06cc\u0632\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u06c1\u0645 \u0646\u06d2 \u0627\u06cc\u06a9 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0633\u0633\u0679\u0645 \u06a9\u0627 \u062c\u0627\u0626\u0632\u06c1 \u0644\u06cc\u0627 \u062c\u06c1\u0627\u06ba JWTs \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0626\u06cc \u062a\u06be\u06cc\u06d4 \u0627\u06cc\u06a9 \u0627\u06cc\u0633\u0627 \u0646\u0638\u0627\u0645 \u062c\u06c1\u0627\u06ba API \u06a9\u06cc\u0632 \u06a9\u0648 \u0633\u0648\u0631\u0633 \u06a9\u0648\u0688 \u0645\u06cc\u06ba \u06c1\u0627\u0631\u0688 \u06a9\u0648\u0688 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0639\u0648\u0627\u0645\u06cc \u0630\u062e\u06cc\u0631\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u0627\u0628\u0646\u062f \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 OAuth \u0631\u06cc \u0688\u0627\u0626\u0631\u06cc\u06a9\u0679 URI \u0627\u06cc\u06a9 \u0627\u06cc\u0633\u0627 \u0646\u0638\u0627\u0645 \u06c1\u06d2 \u062c\u0648 \u0648\u0627\u0626\u0644\u0688 \u06a9\u0627\u0631\u0688\u0632 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0627\u06cc\u06a9 \u0627\u06cc\u0633\u0627 \u0646\u0638\u0627\u0645 \u06c1\u06d2 \u062c\u0648 \u0645\u0627\u0644\u06cc\u0627\u062a\u06cc APIs \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06c1\u0648\u062a\u0627 \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0635\u062f\u06cc\u0642 HTTPS \u06c1\u0648\u0646\u06d2 \u06a9\u06cc \u062a\u0648\u0642\u0639 \u06a9\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u06a9\u0633\u06cc \u0646\u06d2 \u0627\u0633 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u06d4<\/p>\n<p>\u0627\u0646 \u0645\u06cc\u06ba \u0633\u06d2 \u06c1\u0631 \u0627\u06cc\u06a9 \u0627\u06cc\u06a9 \u0632\u0646\u062f\u06c1 \u06a9\u0645\u0632\u0648\u0631\u06cc \u062a\u06be\u06cc \u062c\u0648 \u0627\u0633\u062a\u062d\u0635\u0627\u0644 \u06a9\u06d2 \u0645\u0646\u062a\u0638\u0631 \u062a\u06be\u06cc\u06d4<\/p>\n<p>\u0627\u0646 \u0645\u06cc\u06ba \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0631 \u0645\u0633\u0627\u0626\u0644 \u0644\u0627\u067e\u0631\u0648\u0627\u06c1 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0632 \u06a9\u06cc \u0648\u062c\u06c1 \u0633\u06d2 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u06d2\u06d4 \u0648\u06c1 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0632 \u0633\u06d2 \u0622\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u0633\u0645\u062c\u06be\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u06d2 \u0637\u0631\u06cc\u0642\u0648\u06ba \u06a9\u0648 \u0646\u06c1\u06cc\u06ba \u0633\u0645\u062c\u06be\u062a\u06d2\u06d4 \u0627\u0646\u06c1\u06cc\u06ba \u06a9\u0633\u06cc \u0646\u06d2 \u0646\u06c1\u06cc\u06ba \u0628\u062a\u0627\u06cc\u0627 \u06a9\u06c1 \u062c\u0628 \u06cc\u06c1 \u0679\u0648\u0679\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u06a9\u06cc\u0627 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4 \u06a9\u0633\u06cc \u0646\u06d2 \u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u0628\u062a\u0627\u06cc\u0627 \u06a9\u06c1 \u062a\u0646\u0638\u06cc\u0645 \u06a9\u06d2 \u0645\u0639\u06cc\u0627\u0631\u0627\u062a \u06a9\u06cc\u0627 \u06c1\u06cc\u06ba\u06d4 \u0627\u0646\u06c1\u0648\u06ba \u0646\u06d2 \u062c\u0648 \u06a9\u0686\u06be \u0648\u06c1 \u062c\u0627\u0646\u062a\u06d2 \u062a\u06be\u06d2 \u0644\u06d2 \u0644\u06cc\u0627\u060c \u06a9\u0648\u0688 \u06a9\u0627 \u062c\u0627\u0626\u0632\u06c1 \u0644\u06cc\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u06d2 \u06a9\u0627\u0641\u06cc \u062d\u062f \u062a\u06a9 \u0646\u0627\u0641\u0630 \u06a9\u06cc\u0627\u060c \u0627\u0648\u0631 \u0622\u06af\u06d2 \u0628\u0691\u06be \u06af\u0626\u06d2\u06d4<\/p>\n<p>\u06cc\u06c1 \u0645\u0636\u0645\u0648\u0646 \u0627\u0633 \u06a9\u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u06c1\u06d2\u06d4 \u0646\u06c1 \u0635\u0631\u0641 \u06cc\u06c1 \u062c\u0627\u0646\u06cc\u06ba \u06a9\u06c1 \u06c1\u0631 \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0628\u0644\u06a9\u06c1 \u06cc\u06c1 \u0628\u06be\u06cc \u062c\u0627\u0646\u06cc\u06ba \u06a9\u06c1 \u0627\u0646\u06c1\u06cc\u06ba \u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u060c \u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u06cc\u06c1 \u06a9\u06c1 \u0648\u06c1 \u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u0645\u06cc\u06ba \u06a9\u06cc\u0633\u06d2 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0633\u0628 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u0622\u0626\u06cc\u06d2 \u0627\u0633 \u0627\u0644\u062c\u06be\u0646 \u06a9\u0648 \u062f\u0648\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u062d\u0642\u06cc\u0642\u06cc \u06a9\u0645\u0632\u0648\u0631\u06cc\u0648\u06ba \u06a9\u0627 \u0633\u0628\u0628 \u0628\u0646\u062a\u0627 \u06c1\u06d2\u06d4 \u0645\u0635\u062f\u0642\u06c1 \u062c\u0648\u0627\u0628: \u0622\u067e \u06a9\u0648\u0646 \u06c1\u06cc\u06ba\u061f \u0645\u0635\u062f\u0642\u06c1 \u062c\u0648\u0627\u0628: \u0622\u067e \u06a9\u06cc\u0627 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u061f<\/p>\n<p>\u0627\u06cc\u06a9 \u0627\u06cc\u0633\u0627 \u0646\u0638\u0627\u0645 \u062c\u0648 \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0644\u06cc\u06a9\u0646 \u0645\u0646\u0627\u0633\u0628 \u0627\u062c\u0627\u0632\u062a \u06a9\u0627 \u0641\u0642\u062f\u0627\u0646 \u06c1\u06d2 \u067e\u06be\u0631 \u0628\u06be\u06cc \u063a\u06cc\u0631 \u0645\u062c\u0627\u0632 \u0688\u06cc\u0679\u0627 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u06d2 \u06af\u0627\u06d4 \u0648\u06c1 \u0633\u0633\u0679\u0645 \u062c\u0648 \u0628\u0627\u0644\u06a9\u0644 \u062f\u0631\u0633\u062a \u0644\u06cc\u06a9\u0646 \u0635\u0631\u0641 \u06a9\u0645\u0632\u0648\u0631 \u0637\u0648\u0631 \u067e\u0631 \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0646\u06c1\u06cc\u06ba \u0622\u0633\u0627\u0646\u06cc \u0633\u06d2 \u0646\u0638\u0631\u0627\u0646\u062f\u0627\u0632 \u06a9\u0631 \u062f\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u062f\u0648\u0646\u0648\u06ba \u06a9\u0648 \u0622\u0632\u0627\u062f\u0627\u0646\u06c1 \u0637\u0648\u0631 \u067e\u0631 \u062f\u0631\u0633\u062a \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<h2 id=\"heading-table-of-contents\">\u0627\u0646\u0688\u06cc\u06a9\u0633<\/h2>\n<h2 id=\"heading-prerequisites\">\u0634\u0631\u0627\u0626\u0637<\/h2>\n<p>\u0627\u0633 \u0645\u0636\u0645\u0648\u0646 \u06a9\u0648 \u067e\u0691\u06be\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u0622\u067e \u06a9\u0648 \u062f\u0631\u062c \u0630\u06cc\u0644 \u0633\u06d2 \u0648\u0627\u0642\u0641 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2:<\/p>\n<ul>\n<li>\n<p>API \u06a9\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 HTTP \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u06cc\u06ba \u0627\u0648\u0631 \u062c\u0648\u0627\u0628\u0627\u062a \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u061f<\/p>\n<\/li>\n<li>\n<p>\u0679\u0648\u06a9\u0646 \u06cc\u0627 \u0633\u06cc\u0634\u0646 \u06a9\u06cc\u0627 \u06c1\u06d2 \u0627\u0633 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f\u06cc \u0633\u0645\u062c\u06be<\/p>\n<\/li>\n<li>\n<p>\u0639\u0627\u0645 \u0633\u0627\u0641\u0679 \u0648\u06cc\u0626\u0631 \u0622\u0631\u06a9\u06cc\u0679\u06cc\u06a9\u0686\u0631 \u06a9\u06d2 \u062a\u0635\u0648\u0631\u0627\u062a: \u06af\u06cc\u0679 \u0648\u06d2 \u0627\u0648\u0631 \u0633\u0631\u0648\u0633 \u0644\u06cc\u0626\u0631<\/p>\n<\/li>\n<li>\n<p>\u0688\u0627\u0631\u0679 \u06cc\u0627 C# \u0646\u062d\u0648 \u06a9\u0627 \u0639\u0644\u0645<\/p>\n<\/li>\n<\/ul>\n<p>\u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06a9\u06d2 \u067e\u0633 \u0645\u0646\u0638\u0631 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1\u0627\u06ba \u062a\u0645\u0627\u0645 \u062a\u0635\u0648\u0631\u0627\u062a \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0646\u06af \u06a9\u06d2 \u0646\u0642\u0637\u06c1 \u0646\u0638\u0631 \u0633\u06d2 \u06a9\u06cc \u06af\u0626\u06cc \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-the-foundation-what-you-must-get-right-before-choosing-a-mechanism\">\u0628\u0646\u06cc\u0627\u062f\u06cc \u0628\u0627\u062a\u06cc\u06ba: \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645 \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 \u06a9\u06cc\u0627 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/h2>\n<p>\u0627\u0633 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06a9\u06c1 \u0622\u067e \u06cc\u06c1 \u0633\u0648\u0686\u06cc\u06ba \u06a9\u06c1 \u06a9\u0648\u0646 \u0633\u0627 \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u060c \u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 \u062a\u06cc\u0646 \u0686\u06cc\u0632\u06cc\u06ba \u06c1\u0648\u0646\u06cc \u0686\u0627\u06c1\u0626\u06cc\u06ba\u06d4 \u0627\u0646 \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u06d2 \u0628\u063a\u06cc\u0631\u060c \u06a9\u0648\u0626\u06cc \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u0645\u062f\u062f \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u06d2 \u06af\u0627.<\/p>\n<h3 id=\"heading-1-tls-isnt-optional\">1. TLS \u0627\u062e\u062a\u06cc\u0627\u0631\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/h3>\n<p>\u062a\u0645\u0627\u0645 APIs HTTPS \u067e\u0631 \u0628\u0627\u062a \u0686\u06cc\u062a \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u062a\u0645\u0627\u0645 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1 \u0627\u0648\u0631 \u0645\u0627\u062d\u0648\u0644\u060c \u0646\u06c1 \u0635\u0631\u0641 \u067e\u06cc\u062f\u0627\u0648\u0627\u0631\u06d4 \u06cc\u06c1 \u0635\u0631\u0641 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u062c\u0648 \u06a9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631\u0648\u06ba \u067e\u0631 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0646 \u0633\u0628 \u06a9\u06d2<\/p>\n<p>TLS \u06a9\u06d2 \u0628\u063a\u06cc\u0631\u060c \u0627\u0633 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u0645\u06cc\u06ba \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u0648 \u0631\u0648\u06a9\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0635\u062f\u06cc\u0642\u06cc \u0679\u0648\u06a9\u0646\u060c API \u06a9\u06cc\u0632\u060c \u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646\u060c \u0627\u0648\u0631 JWTs \u0633\u0628\u06be\u06cc HTTP \u06c1\u06cc\u0688\u0631 \u0645\u06cc\u06ba \u062c\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 HTTP \u06c1\u06cc\u0688\u0631 TLS \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u0633\u0627\u062f\u06c1 \u0645\u062a\u0646 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0622\u067e \u06a9\u06d2 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u0648 \u06a9\u0645 \u0627\u0632 \u06a9\u0645 TLS 1.2 \u0646\u0627\u0641\u0630 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 TLS 1.0 \u0627\u0648\u0631 1.1 \u0645\u06cc\u06ba \u06a9\u0645\u0632\u0648\u0631\u06cc\u0627\u06ba \u0645\u0639\u0644\u0648\u0645 \u06c1\u06cc\u06ba\u06d4 SSLv3 \u0628\u0631\u06cc \u0637\u0631\u062d \u0679\u0648\u0679 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u06a9\u0648\u0626\u06cc \u06a9\u0644\u0627\u0626\u0646\u0679 \u067e\u0631\u0627\u0646\u06d2 \u067e\u0631\u0648\u0679\u0648\u06a9\u0648\u0644 \u0648\u0631\u0698\u0646 \u067e\u0631 \u06af\u0641\u062a \u0648 \u0634\u0646\u06cc\u062f \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u06a9\u0648\u0634\u0634 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u067e\u0631\u062a \u06a9\u0648 \u06a9\u0646\u06a9\u0634\u0646 \u06a9\u0648 \u0645\u0633\u062a\u0631\u062f \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u06cc\u06c1 \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u06a9\u0627 \u0641\u06cc\u0635\u0644\u06c1 \u06c1\u06d2 \u0646\u06c1 \u06a9\u06c1 \u06a9\u0648\u0626\u06cc \u0627\u06cc\u0633\u06cc \u0686\u06cc\u0632 \u062c\u0633\u06d2 \u0622\u067e \u0627\u067e\u0646\u06d2 \u06a9\u0648\u0688 \u0645\u06cc\u06ba \u0633\u0646\u0628\u06be\u0627\u0644\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-2-production-apis-must-not-be-accessible-on-public-tooling-without-proper-controls\">2. \u0639\u0648\u0627\u0645\u06cc \u0679\u0648\u0644\u0632 \u06a9\u0648 \u0645\u0646\u0627\u0633\u0628 \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 APIs \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0642\u0627\u0628\u0644 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/h3>\n<p>\u0645\u0646\u0627\u0633\u0628 \u0631\u0633\u0627\u0626\u06cc \u06a9\u0646\u0679\u0631\u0648\u0644 \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u067e\u0648\u0633\u0679 \u0645\u06cc\u0646 \u06cc\u0627 \u0633\u0648\u06cc\u06af\u0631 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0627\u0646\u0679\u0631\u0646\u06cc\u0679 \u067e\u0631 \u0642\u0627\u0628\u0644 \u0631\u0633\u0627\u0626\u06cc \u0627\u06cc\u06a9 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 API \u0627\u06cc\u06a9 \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2 \u062c\u0633 \u06a9\u0627 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0688\u06cc\u0648\u0644\u067e\u0645\u0646\u0679 \u0627\u0648\u0631 \u0679\u06cc\u0633\u0679\u0646\u06af \u06a9\u0648 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0688\u06cc\u0679\u0627 \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u0639\u0644\u06cc\u062d\u062f\u06c1 \u0627\u0633\u0646\u0627\u062f \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0633\u0631\u0634\u0627\u0631 \u0645\u0627\u062d\u0648\u0644 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<h3 id=\"heading-3-production-data-must-not-be-copied-to-development-or-test-environments\">3. \u067e\u06cc\u062f\u0627\u0648\u0627\u0631\u06cc \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u062a\u0631\u0642\u06cc \u06cc\u0627 \u062c\u0627\u0646\u0686 \u06a9\u06d2 \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u06a9\u0627\u067e\u06cc \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u062c\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/h3>\n<p>\u06cc\u06c1 \u0635\u0631\u0641 \u0627\u0686\u06be\u06cc \u0645\u0634\u0642 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0646\u0627\u0626\u06cc\u062c\u06cc\u0631\u06cc\u0627 \u06a9\u06d2 NDPA 2023 \u06a9\u06d2 \u062a\u062d\u062a\u060c \u0630\u0627\u062a\u06cc \u0688\u06cc\u0679\u0627 \u067e\u0631 \u0635\u0631\u0641 \u0648\u0627\u0636\u062d\u060c \u0648\u0627\u0636\u062d \u0627\u0648\u0631 \u0642\u0627\u0646\u0648\u0646\u06cc \u0645\u0642\u0627\u0635\u062f \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u06a9\u06cc \u062c\u0627\u0646\u06cc \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u06a9\u06d2 \u0630\u0627\u062a\u06cc \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u062a\u0631\u0642\u06cc\u0627\u062a\u06cc \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u06a9\u0627\u067e\u06cc \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u0642\u0627\u0646\u0648\u0646\u06cc \u0646\u0645\u0627\u0626\u0634 \u067e\u06cc\u062f\u0627 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 PCI-DSS \u0645\u06cc\u06ba \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0627\u06cc\u0633\u06d2 \u0645\u0627\u062d\u0648\u0644 \u06a9\u06cc \u062a\u0639\u0645\u06cc\u0644 \u0634\u0627\u0645\u0644 \u06c1\u06d2 \u062c\u0648 \u06a9\u0627\u0631\u0688 \u06c1\u0648\u0644\u0688\u0631 \u06a9\u06d2 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0627\u0633\u0679\u0648\u0631\u060c \u067e\u0631\u0648\u0633\u06cc\u0633\u060c \u06cc\u0627 \u0645\u0646\u062a\u0642\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0646\u06af \u06a9\u0627 \u062c\u0648\u0627\u0628 \u06c1\u0645\u06cc\u0634\u06c1 \u0645\u0635\u0646\u0648\u0639\u06cc \u0679\u06cc\u0633\u0679 \u0688\u06cc\u0679\u0627 \u0627\u0648\u0631 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u063a\u06cc\u0631 \u067e\u06cc\u062f\u0627\u0648\u0627\u0631\u06cc \u0645\u0627\u062d\u0648\u0644 \u0633\u06d2 \u06af\u0645\u0646\u0627\u0645 \u0688\u06cc\u0679\u0627 \u0633\u06cc\u0679 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633 \u06a9\u0627 \u0627\u0637\u0644\u0627\u0642 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0633\u0627\u062a \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645 \u062f\u0631\u062c \u0630\u06cc\u0644 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-1-basic-authentication\">1. \u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0635\u062f\u06cc\u0642<\/h2>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u06a9\u0644\u0627\u0626\u0646\u0679 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0635\u0627\u0631\u0641 \u0646\u0627\u0645 \u0627\u0648\u0631 \u067e\u0627\u0633 \u0648\u0631\u0688 \u0628\u06be\u06cc\u062c\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633\u0646\u0627\u062f \u06a9\u0648 \u0627\u0633 \u0637\u0631\u062d \u0645\u0644\u0627\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2: <code>username:password<\/code>\u06cc\u06c1 Base64 \u06a9\u0648 \u0627\u0646\u06a9\u0648\u0688 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u062c\u0627\u0632\u062a \u06a9\u06d2 \u06c1\u06cc\u0688\u0631 \u0645\u06cc\u06ba \u0631\u06a9\u06be\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">Authorization: Basic am9objpzZWNyZXQxMjM=\n<\/code><\/pre>\n<p>\u0627\u0646\u06a9\u0648\u0688 \u0634\u062f\u06c1 \u062a\u0627\u0631 \u06c1\u06d2\u06d4 <code>john:secret123<\/code> \u0628\u06cc\u0633 64 \u0645\u06cc\u06ba\u06d4 Base64 \u062e\u0641\u06cc\u06c1 \u06a9\u0627\u0631\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u0646\u06a9\u0648\u0688\u0646\u06af\u06d4 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u062c\u0648 \u0627\u0646 \u06c1\u06cc\u0688\u0631 \u06a9\u0648 \u067e\u06a9\u0691\u062a\u0627 \u06c1\u06d2 \u0648\u06c1 \u0622\u0646 \u0644\u0627\u0626\u0646 \u062f\u0633\u062a\u06cc\u0627\u0628 Base64 \u0688\u06cc\u06a9\u0648\u0688\u0631 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0627\u0646\u06c1\u06cc\u06ba \u0633\u06cc\u06a9\u0646\u0688\u0648\u06ba \u0645\u06cc\u06ba \u0688\u06cc \u06a9\u0648\u0688 \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0688\u0627\u0631\u0679:<\/strong><\/p>\n<pre><code class=\"language-dart\">\/\/ server-side basic auth validation\nString? extractBasicAuthCredentials(Request request) {\n  final authHeader = request.headers['authorization'];\n  if (authHeader == null || !authHeader.startsWith('Basic ')) return null;\n\n  final encoded = authHeader.substring(6);\n  final decoded = utf8.decode(base64.decode(encoded));\n  return decoded; \n}\n\nHandler basicAuthMiddleware(Handler handler, UserService userService) {\n  return (Request request) async {\n    final credentials = extractBasicAuthCredentials(request);\n    if (credentials == null) {\n      return Response.unauthorized(\n        'Missing credentials',\n        headers: {'WWW-Authenticate': 'Basic realm=\"API\"'},\n      );\n    }\n\n    final parts = credentials.split(':');\n    if (parts.length != 2) return Response.unauthorized('Invalid credentials');\n\n    final isValid = await userService.validateCredentials(parts[0], parts[1]);\n    if (!isValid) return Response.unauthorized('Invalid credentials');\n\n    return handler(request);\n  };\n}\n<\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">public class BasicAuthHandler : AuthenticationHandler<authenticationschemeoptions>\n{\n    private readonly IUserService _userService;\n\n    protected override async Task<authenticateresult> HandleAuthenticateAsync()\n    {\n        if (!Request.Headers.ContainsKey(\"Authorization\"))\n            return AuthenticateResult.Fail(\"Missing Authorization header\");\n\n        var authHeader = Request.Headers[\"Authorization\"].ToString();\n        if (!authHeader.StartsWith(\"Basic \"))\n            return AuthenticateResult.Fail(\"Invalid Authorization scheme\");\n\n        var encoded = authHeader.Substring(6);\n        var decoded = Encoding.UTF8.GetString(Convert.FromBase64String(encoded));\n        var parts = decoded.Split(':');\n\n        if (parts.Length != 2)\n            return AuthenticateResult.Fail(\"Invalid credentials format\");\n\n        var isValid = await _userService.ValidateCredentials(parts[0], parts[1]);\n        if (!isValid)\n            return AuthenticateResult.Fail(\"Invalid credentials\");\n\n        var claims = new[] { new Claim(ClaimTypes.Name, parts[0]) };\n        var identity = new ClaimsIdentity(claims, Scheme.Name);\n        var principal = new ClaimsPrincipal(identity);\n        var ticket = new AuthenticationTicket(principal, Scheme.Name);\n\n        return AuthenticateResult.Success(ticket);\n    }\n}\n<\/authenticateresult><\/authenticationschemeoptions><\/code><\/pre>\n<h3 id=\"heading-the-real-problem-with-basic-auth\">\u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u062d\u0642\u06cc\u0642\u06cc \u0645\u0633\u0627\u0626\u0644<\/h3>\n<p>\u0627\u0633\u0646\u0627\u062f \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0645\u0646\u062a\u0642\u0644 \u06a9\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0648 \u0645\u0633\u062a\u0642\u0644 \u0637\u0648\u0631 \u067e\u0631 \u0631\u0648\u06a9\u0646\u0627 \u062d\u0645\u0644\u06c1 \u0622\u0648\u0631 \u06a9\u0648 \u0622\u067e \u06a9\u0627 \u0635\u0627\u0631\u0641 \u0646\u0627\u0645 \u0627\u0648\u0631 \u067e\u0627\u0633 \u0648\u0631\u0688 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06a9\u0648\u0626\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u0633\u06d2 \u0645\u0646\u0633\u0648\u062e \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u0633\u0648\u0627\u0626\u06d2 \u0627\u067e\u0646\u0627 \u067e\u0627\u0633 \u0648\u0631\u0688 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2\u06d4 Base64 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0637\u0631\u062d \u06a9\u06cc \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u0641\u0631\u0627\u06c1\u0645 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06d2 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u0648\u06ba \u067e\u0631 \u0634\u0631\u062d \u0645\u062d\u062f\u0648\u062f \u0646\u06c1 \u06c1\u0648\u0646\u0627 \u0648\u062d\u0634\u06cc\u0627\u0646\u06c1 \u062d\u0645\u0644\u0648\u06ba \u06a9\u06cc \u06a9\u06be\u0644\u06cc \u062f\u0639\u0648\u062a \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u062d\u0645\u0644\u06c1 \u0622\u0648\u0631 \u062c\u0633 \u06a9\u06d2 \u067e\u0627\u0633 \u0639\u0627\u0645 \u067e\u0627\u0633 \u0648\u0631\u0688\u0632 \u06a9\u06cc \u0641\u06c1\u0631\u0633\u062a \u06c1\u06d2 \u0627\u0646 \u0633\u0628 \u06a9\u0648 \u0645\u0646\u0638\u0645 \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0622\u0632\u0645\u0627\u0626\u06d2 \u06af\u0627\u06d4 \u0627\u06af\u0631 \u0627\u0646\u06c1\u06cc\u06ba \u06a9\u0686\u06be \u0646\u06c1\u06cc\u06ba \u0631\u0648\u06a9\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u0648\u06c1 \u0628\u0627\u0644\u0622\u062e\u0631 \u062d\u0645\u0644\u06c1 \u06a9\u0631 \u062f\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<h3 id=\"heading-when-to-use-it\">\u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0627\u06cc\u06a9 \u0645\u0636\u0628\u0648\u0637\u06cc \u0633\u06d2 \u06a9\u0646\u0679\u0631\u0648\u0644 \u0634\u062f\u06c1 \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u0633\u0631\u0648\u0631 \u0633\u06d2 \u0633\u0631\u0648\u0631 \u0645\u0648\u0627\u0635\u0644\u0627\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u06a9\u0646\u06a9\u0634\u0646 \u06c1\u0645\u06cc\u0634\u06c1 \u062e\u0641\u06cc\u06c1 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 API \u06a9\u06cc \u0633\u0637\u062d \u0627\u0646\u0679\u0631\u0646\u06cc\u0679 \u06a9\u06d2 \u0633\u0627\u0645\u0646\u06d2 \u0646\u06c1\u06cc\u06ba \u0622\u062a\u06cc \u06c1\u06d2\u06d4 \u06a9\u0628\u06be\u06cc \u0628\u06be\u06cc \u0635\u0627\u0631\u0641 \u06a9\u0627 \u0633\u0627\u0645\u0646\u0627 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06d2 APIs\u060c \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0686\u06cc\u0632 \u062c\u0648 \u062d\u0633\u0627\u0633 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u06c1\u06cc\u0646\u0688\u0644 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u060c \u06cc\u0627 TLS \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0686\u06cc\u0632 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-2-api-keys\">2. API \u06a9\u0644\u06cc\u062f<\/h2>\n<p>API \u06a9\u0644\u06cc\u062f \u0627\u06cc\u06a9 \u0645\u0646\u0641\u0631\u062f\u060c \u062e\u0641\u06cc\u06c1 \u062a\u0627\u0631 \u06c1\u06d2 \u062c\u0633\u06d2 \u0633\u0631\u0648\u0631 \u0627\u0633 \u06a9\u06cc \u0634\u0646\u0627\u062e\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0644\u0627\u0626\u0646\u0679 \u06a9\u0648 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u06a9\u0644\u06cc\u062f \u0627\u0633 \u0648\u0642\u062a \u062c\u0627\u0631\u06cc \u06a9\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2 \u062c\u0628 \u0622\u067e \u0641\u0631\u06cc\u0642 \u062b\u0627\u0644\u062b \u06a9\u06cc \u062e\u062f\u0645\u062a\u060c \u062c\u06cc\u0633\u06d2 \u06a9\u06c1 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u0627 \u06af\u06cc\u0679 \u0648\u06d2 \u06cc\u0627 SMS \u067e\u0644\u06cc\u0679 \u0641\u0627\u0631\u0645 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0646\u062f\u0631\u0627\u062c \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0622\u067e \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0627\u0633 \u0633\u0631\u0648\u0633 \u0633\u06d2 \u062c\u0648 \u0628\u06be\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u0627\u0633 \u0645\u06cc\u06ba \u0648\u06c1 \u06a9\u0644\u06cc\u062f \u0634\u0627\u0645\u0644 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u060c \u062a\u0627\u06a9\u06c1 \u0633\u0631\u0648\u0633 \u062c\u0627\u0646 \u0633\u06a9\u06d2 \u06a9\u06c1 \u06a9\u0648\u0646 \u06a9\u0627\u0644 \u06a9\u0631 \u0631\u06c1\u0627 \u06c1\u06d2\u060c \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0648 \u0679\u0631\u06cc\u06a9 \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u067e\u0631 \u062f\u0631\u0633\u062a \u0627\u062c\u0627\u0632\u062a\u0648\u06ba \u0627\u0648\u0631 \u0634\u0631\u062d \u06a9\u06cc \u062d\u062f\u0648\u06ba \u06a9\u0627 \u0627\u0637\u0644\u0627\u0642 \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0635\u0627\u0631\u0641 \u0633\u06d2 \u06a9\u0648\u0626\u06cc \u062a\u0639\u0644\u0642 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0622\u067e \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0633\u06d2 \u0645\u0646\u0633\u0644\u06a9 \u06c1\u06d2\u06d4 \u06cc\u06c1 API \u06a9\u06cc\u0632 \u0627\u0648\u0631 \u0635\u0627\u0631\u0641 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06d2 \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0641\u0631\u0642 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u0627\u06cc\u06a9 \u062c\u0627\u0645\u062f \u062e\u0641\u06cc\u06c1 \u062a\u0627\u0631 \u06a9\u0644\u0627\u0626\u0646\u0679 \u06a9\u0648 \u062c\u0627\u0631\u06cc \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u06c1\u06cc\u0688\u0631 \u0645\u06cc\u06ba \u0628\u06be\u06cc\u062c\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">X-API-Key: sk_live_abc123xyz\n<\/code><\/pre>\n<p><strong>\u0688\u0627\u0631\u0679:<\/strong><\/p>\n<pre><code class=\"language-dart\">class ApiKeyService {\n  final ApiKeyRepository _repository;\n\n  ApiKeyService(this._repository);\n\n  Future<result appexception=\"\">> validateApiKey(\n    String apiKey,\n    String callerDomain,\n  ) async {\n    final keyRecord = await _repository.findByKey(apiKey);\n\n    if (keyRecord == null) {\n      return Result.failure(AppException.unauthorized('Invalid API key'));\n    }\n\n    if (keyRecord.isExpired) {\n      return Result.failure(AppException.unauthorized('API key has expired'));\n    }\n\n    if (keyRecord.isRevoked) {\n      return Result.failure(AppException.unauthorized('API key has been revoked'));\n    }\n\n    \/\/ validate that the calling domain is allowed for this key\n    if (!keyRecord.allowedDomains.contains(callerDomain)) {\n      return Result.failure(\n        AppException.forbidden('Calling domain not authorized for this API key'),\n      );\n    }\n\n    return Result.success(ApiKeyContext(\n      clientId: keyRecord.clientId,\n      environment: keyRecord.environment,\n      allowedScopes: keyRecord.allowedScopes,\n    ));\n  }\n}\n\nHandler apiKeyMiddleware(Handler handler, ApiKeyService apiKeyService) {\n  return (Request request) async {\n    final apiKey = request.headers['x-api-key'];\n    if (apiKey == null || apiKey.isEmpty) {\n      return Response(401, body: jsonEncode({'error': 'API key required'}));\n    }\n\n    final origin = request.headers['origin'] ?? request.headers['host'] ?? '';\n    final result = await apiKeyService.validateApiKey(apiKey, origin);\n\n    if (result.isFailure) {\n      return Response(403, body: jsonEncode({'error': result.error?.message}));\n    }\n\n    return handler(request);\n  };\n}\n<\/result><\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">public class ApiKeyMiddleware\n{\n    private readonly RequestDelegate _next;\n    private readonly IApiKeyService _apiKeyService;\n\n    public async Task InvokeAsync(HttpContext context)\n    {\n        if (!context.Request.Headers.TryGetValue(\"X-API-Key\", out var apiKey))\n        {\n            context.Response.StatusCode = 401;\n            await context.Response.WriteAsync(\"API key required\");\n            return;\n        }\n\n        var callerDomain = context.Request.Headers[\"Origin\"].ToString()\n            ?? context.Request.Host.Value;\n\n        var result = await _apiKeyService.ValidateApiKey(apiKey, callerDomain);\n\n        if (!result.IsSuccess)\n        {\n            context.Response.StatusCode = 403;\n            await context.Response.WriteAsync(result.Error);\n            return;\n        }\n\n        context.Items[\"ApiKeyContext\"] = result.Value;\n        await _next(context);\n    }\n}\n<\/code><\/pre>\n<h3 id=\"heading-the-real-problem-with-api-keys\">API \u06a9\u06cc\u0632 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0635\u0644 \u0645\u0633\u0626\u0644\u06c1<\/h3>\n<p>API \u06a9\u06cc\u0632 \u062c\u0627\u0645\u062f \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u062e\u062a\u0645 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4 \u0639\u0648\u0627\u0645\u06cc GitHub \u0630\u062e\u06cc\u0631\u0648\u06ba\u060c Slack \u067e\u06cc\u063a\u0627\u0645\u0627\u062a\u060c \u06cc\u0627 \u0644\u0627\u06af \u0641\u0627\u0626\u0644\u0648\u06ba \u0645\u06cc\u06ba \u067e\u0627\u0626\u06cc \u062c\u0627\u0646\u06d2 \u0648\u0627\u0644\u06cc \u06a9\u0644\u06cc\u062f\u06cc\u06ba \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u0644\u0627\u0626\u06cc\u0648 \u0627\u0633\u0646\u0627\u062f \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u06a9\u0648\u0626\u06cc \u0627\u0646\u06c1\u06cc\u06ba \u0646\u0648\u0679\u0633 \u0646\u06c1 \u0644\u06d2 \u0627\u0648\u0631 \u0627\u0646 \u06a9\u06cc \u062c\u06af\u06c1 \u0644\u06d2 \u0644\u06d2\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 \u0633\u0628 \u0633\u06d2 \u0639\u0627\u0645 \u0641\u0631\u0642 \u062c\u0648 \u0645\u06cc\u06ba \u0628\u0691\u06cc \u062a\u0646\u0638\u06cc\u0645\u0648\u06ba \u0645\u06cc\u06ba \u062f\u06cc\u06a9\u06be \u0631\u06c1\u0627 \u06c1\u0648\u06ba \u0648\u06c1 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u06a9\u0644\u0627\u0626\u0646\u0679\u0633 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06c1 \u0628\u0644\u0627\u0626\u06d2 \u06af\u0626\u06d2 APIs \u0645\u06cc\u06ba \u0688\u0648\u0645\u06cc\u0646 \u0648\u0627\u0626\u0679 \u0644\u0633\u0679 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u06c1\u06cc \u06a9\u0644\u06cc\u062f \u062a\u0645\u0627\u0645 \u0688\u0648\u0645\u06cc\u0646\u0632 \u0645\u06cc\u06ba \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u06a9\u0644\u0627\u0626\u0646\u0679\u0633 \u0627\u0648\u0631 \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u0686\u0627\u0628\u06cc\u0627\u06ba \u0628\u0627\u0646\u0679\u0646\u06d2 \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u0633\u0679\u06cc\u062c\u0646\u06af \u06a9\u06cc\u0632 \u06a9\u0648 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0645\u06cc\u06ba \u0628\u0644\u0627\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u060c \u0645\u0648\u0628\u0627\u0626\u0644 \u06a9\u06cc\u0632 \u0648\u06cc\u0628 \u06a9\u0644\u0627\u0626\u0646\u0679\u0633 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc \u062c\u0627 \u0633\u06a9\u062a\u06cc \u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 \u062f\u0648\u0646\u0648\u06ba \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u06a9\u0648\u0626\u06cc \u062d\u0642\u06cc\u0642\u06cc \u062d\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<p>API \u06a9\u06cc\u0632 \u06a9\u0648 \u0645\u062a\u0639\u062f\u062f \u06a9\u0644\u0627\u0626\u0646\u0679\u0633 \u06cc\u0627 \u0645\u062a\u0639\u062f\u062f \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u06a9\u0627\u0645 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u0686\u0627\u0628\u06cc\u0627\u06ba \u0645\u062e\u0635\u0648\u0635 \u0648\u0627\u0626\u0679 \u0644\u0633\u0679 \u0634\u062f\u06c1 \u0688\u0648\u0645\u06cc\u0646\u0632 \u0627\u0648\u0631 \u0645\u062e\u0635\u0648\u0635 \u0645\u0627\u062d\u0648\u0644 \u0633\u06d2 \u0645\u0646\u0633\u0644\u06a9 \u06c1\u0648\u0646\u06cc \u0686\u0627\u06c1\u0626\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0627\u062e\u062a\u06cc\u0627\u0631\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u067e\u0646\u06d2 \u0633\u0648\u0631\u0633 \u06a9\u0648\u0688 \u0645\u06cc\u06ba API \u06a9\u06cc\u0632 \u06a9\u0648 \u06c1\u0627\u0631\u0688 \u06a9\u0648\u0688 \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4 \u06a9\u0628\u06be\u06cc \u0628\u06be\u06cc \u06af\u0679 \u06a9\u0627 \u0639\u06c1\u062f \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4 <code>.gitignore<\/code> \u06cc\u06c1 \u06a9\u0627\u0641\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0631\u0646 \u0679\u0627\u0626\u0645 \u067e\u0631 \u0686\u0627\u0628\u06cc\u0627\u06ba \u0627\u06cc\u06a9 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u062e\u0641\u06cc\u06c1 \u0645\u06cc\u0646\u06cc\u062c\u0631 (\u0648\u0627\u0644\u0679\u0633\u060c Azure \u0627\u06cc\u067e \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646\u060c AWS \u0633\u06cc\u06a9\u0631\u0679\u0633 \u0645\u06cc\u0646\u06cc\u062c\u0631) \u0633\u06d2 \u062d\u0627\u0635\u0644 \u06a9\u06cc \u062c\u0627\u0646\u06cc \u0686\u0627\u06c1\u0626\u06cc\u06ba\u06d4 API \u06a9\u06cc\u0632 \u06a9\u0648 \u06af\u06be\u0648\u0645\u0646\u0627 \u0627\u06cc\u06a9 \u0645\u0646\u0635\u0648\u0628\u06c1 \u0628\u0646\u062f \u062a\u0646\u0638\u06cc\u0645\u06cc \u0639\u0645\u0644 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u060c \u0646\u06c1 \u06a9\u06c1 \u0645\u0634\u062a\u0628\u06c1 \u062e\u0644\u0627\u0641 \u0648\u0631\u0632\u06cc \u06a9\u0627 \u062c\u0648\u0627\u0628\u06d4<\/p>\n<h3 id=\"heading-when-to-use-it\">\u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0633\u0631\u0648\u0631 \u0633\u06d2 \u0633\u0631\u0648\u0631 \u0645\u0648\u0627\u0635\u0644\u0627\u062a\u060c \u0639\u0648\u0627\u0645\u06cc APIs \u062c\u06c1\u0627\u06ba \u06a9\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u0648\u06ba \u06a9\u06cc \u0634\u0646\u0627\u062e\u062a \u0627\u0648\u0631 \u0634\u0631\u062d \u0645\u062d\u062f\u0648\u062f \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0688\u0648\u06cc\u0644\u067e\u0631 \u0679\u0648\u0644\u0632 \u0627\u0648\u0631 \u0627\u0646\u0636\u0645\u0627\u0645 \u06a9\u06d2 \u0644\u06cc\u06d2 API \u06a9\u06cc\u0632 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0645\u0646\u0638\u0631 \u062c\u06c1\u0627\u06ba \u0627\u0646\u0633\u0627\u0646\u06cc \u0635\u0627\u0631\u0641 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u06a9\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-3-bearer-token-authentication\">3. \u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642<\/h2>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u06a9\u0644\u0627\u0626\u0646\u0679 \u0644\u0627\u06af \u0627\u0646 \u0641\u0644\u0648 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633\u06d2 \u0627\u06cc\u06a9 \u0679\u0648\u06a9\u0646 \u0645\u0644\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0679\u0648\u06a9\u0646 \u0628\u0639\u062f \u06a9\u06cc \u062a\u0645\u0627\u0645 \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u06a9\u06d2 \u0627\u062c\u0627\u0632\u062a \u0646\u0627\u0645\u06d2 \u06a9\u06d2 \u06c1\u06cc\u0688\u0631 \u0645\u06cc\u06ba \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u06d2 \u067e\u06c1\u0644\u06d2 \u0644\u0627\u06af \u0627\u0646 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 \u06a9\u0648\u0626\u06cc \u0627\u0633\u0646\u0627\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u06ba \u06af\u06cc\u06d4 \u0679\u0648\u06a9\u0646 \u0645\u0646\u062a\u0642\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0633\u0631\u0648\u0631 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 \u0679\u0648\u06a9\u0646 \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0688\u0627\u0631\u0679:<\/strong><\/p>\n<pre><code class=\"language-dart\">class BearerTokenMiddleware {\n  final TokenValidator _validator;\n\n  BearerTokenMiddleware(this._validator);\n\n  Handler call(Handler handler) {\n    return (Request request) async {\n      final authHeader = request.headers['authorization'];\n\n      if (authHeader == null || !authHeader.startsWith('Bearer ')) {\n        return Response(401, body: jsonEncode({'error': 'Bearer token required'}));\n      }\n\n      final token = authHeader.substring(7);\n      final validationResult = await _validator.validate(token);\n\n      if (validationResult.isFailure) {\n        return Response(401, body: jsonEncode({'error': validationResult.error?.message}));\n      }\n\n      final updatedRequest = request.change(\n        context: {'auth_claims': validationResult.value},\n      );\n\n      return handler(updatedRequest);\n    };\n  }\n}\n<\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)\n    .AddJwtBearer(options =>\n    {\n        options.TokenValidationParameters = new TokenValidationParameters\n        {\n            ValidateIssuer = true,\n            ValidateAudience = true,\n            ValidateLifetime = true,\n            ValidateIssuerSigningKey = true,\n            ValidIssuer = builder.Configuration[\"Jwt:Issuer\"],\n            ValidAudience = builder.Configuration[\"Jwt:Audience\"],\n            IssuerSigningKey = new SymmetricSecurityKey(\n                Encoding.UTF8.GetBytes(builder.Configuration[\"Jwt:Secret\"]!)\n            ),\n            ClockSkew = TimeSpan.Zero\n        };\n    });\n<\/code><\/pre>\n<h3 id=\"heading-the-real-problem-with-bearer-tokens\">\u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0635\u0644 \u0645\u0633\u0626\u0644\u06c1<\/h3>\n<p>\u0679\u0648\u06a9\u0646 \u0686\u0648\u0631\u06cc \u0633\u0628 \u0633\u06d2 \u0628\u0691\u0627 \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062c\u0628 \u062d\u0645\u0644\u06c1 \u0622\u0648\u0631 \u0627\u06cc\u06a9 \u062f\u0631\u0633\u062a \u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646 \u062d\u0627\u0635\u0644 \u06a9\u0631 \u0644\u06cc\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u0648\u06c1 \u0627\u0633\u06d2 \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u0679\u0648\u06a9\u0646 \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u0646\u06c1 \u06c1\u0648 \u062c\u0627\u0626\u06d2 \u06cc\u0627 \u0627\u0633\u06d2 \u062f\u0633\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0645\u0646\u0633\u0648\u062e \u0646\u06c1 \u06a9\u0631 \u062f\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4 \u06cc\u06c1\u06cc \u0648\u062c\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0679\u0648\u06a9\u0646 \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06a9\u0631\u0646\u0627 \u0636\u0631\u0648\u0631\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0646\u0642\u0635\u0627\u0646 \u06a9\u0648 \u0645\u062d\u062f\u0648\u062f \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06c1\u06d2 \u062c\u0628 \u0679\u0648\u06a9\u0646\u0632 \u06a9\u0648 \u0646\u0642\u0635\u0627\u0646 \u067e\u06c1\u0646\u0686\u06d2\u06d4 \u0631\u06cc\u0641\u0631\u06cc\u0634 \u0679\u0648\u06a9\u0646 \u0631\u0648\u0679\u06cc\u0634\u0646 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u06cc\u06a9 \u0642\u0644\u06cc\u0644 \u0627\u0644\u0645\u062f\u062a \u0631\u0633\u0627\u0626\u06cc \u0679\u0648\u06a9\u0646 \u062f\u0631\u0633\u062a \u0646\u0645\u0648\u0646\u06c1 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-when-to-use-it\">\u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u06cc\u06c1 \u0633\u0628 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062c\u062f\u06cc\u062f \u0648\u06cc\u0628 \u0627\u0648\u0631 \u0645\u0648\u0628\u0627\u0626\u0644 APIs\u060c \u0635\u0627\u0631\u0641 \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06d2 \u0628\u06c1\u0627\u0624\u060c \u0627\u0648\u0631 \u06a9\u0633\u06cc \u0628\u06be\u06cc API \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0686\u06be\u06cc \u0637\u0631\u062d \u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u0679\u06cc\u0679 \u0644\u06cc\u0633 \u0627\u0648\u0631 \u062a\u0648\u0633\u06cc\u0639 \u067e\u0630\u06cc\u0631 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-4-jwt-json-web-token\">4. JWT &#8211; JSON \u0648\u06cc\u0628 \u0679\u0648\u06a9\u0646<\/h2>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>JWT \u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646 \u06a9\u0627 \u0627\u06cc\u06a9 \u0645\u062e\u0635\u0648\u0635 \u0641\u0627\u0631\u0645\u06cc\u0679 \u06c1\u06d2 \u0646\u06c1 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0639\u0644\u06cc\u062d\u062f\u06c1 \u062a\u0635\u062f\u06cc\u0642\u06cc \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u06d2\u06d4 \u06cc\u06c1 \u0627\u06cc\u06a9 \u0627\u0633\u0679\u06cc\u0646\u0688 \u0679\u0648\u06a9\u0646 \u06c1\u06d2 \u062c\u0648 \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u06c1\u06cc \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u062f\u0639\u0648\u06d2 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>JWT \u06a9\u06d2 \u062a\u06cc\u0646 \u062d\u0635\u06d2 \u0646\u0642\u0637\u0648\u06ba \u0633\u06d2 \u0627\u0644\u06af \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">Header.Payload.Signature\neyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxMjMiLCJyb2xlIjoiYWRtaW4ifQ.SIGNATURE\n<\/code><\/pre>\n<p>\u06c1\u06cc\u0688\u0631 \u062f\u0633\u062a\u062e\u0637\u06cc \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u0635\u0627\u0631\u0641 \u06a9\u06cc \u0634\u0646\u0627\u062e\u062a\u060c \u06a9\u0631\u062f\u0627\u0631\u060c \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u06a9\u0627 \u0648\u0642\u062a\u060c \u0627\u0648\u0631 \u062c\u0627\u0631\u06cc \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0648\u0642\u062a \u062c\u06cc\u0633\u06d2 \u062f\u0639\u0648\u06d2 \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba\u06d4 \u062f\u0633\u062a\u062e\u0637 \u0627\u06cc\u06a9 \u06a9\u0631\u067e\u0679\u0648\u06af\u0631\u0627\u0641\u06a9 \u06c1\u06cc\u0634 \u06c1\u06d2 \u062c\u0648 \u062b\u0627\u0628\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0679\u0648\u06a9\u0646 \u0633\u0631\u0648\u0631 \u0633\u06d2 \u0622\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0686\u06be\u06cc\u0691 \u0686\u06be\u0627\u0691 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc \u06af\u0626\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u0633\u0631\u0648\u0631 \u062e\u0641\u06cc\u06c1 \u0637\u0648\u0631 \u067e\u0631 \u062f\u0633\u062a\u062e\u0637 \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0646\u062f\u0631 \u06a9\u06d2 \u062f\u0639\u0648\u0648\u06ba \u067e\u0631 \u0628\u06be\u0631\u0648\u0633\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u062a\u0644\u0627\u0634 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1\u06cc \u0648\u06c1 \u0686\u06cc\u0632 \u06c1\u06d2 \u062c\u0648 JWT \u06a9\u0648 \u0628\u06d2 \u0648\u0637\u0646 \u0627\u0648\u0631 \u0642\u0627\u0628\u0644 \u062a\u0648\u0633\u06cc\u0639 \u0628\u0646\u0627\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0688\u0627\u0631\u0679:<\/strong><\/p>\n<pre><code class=\"language-dart\">class JwtService {\n  final String _secret;\n  final String _issuer;\n  final Duration _accessTokenExpiry;\n\n  JwtService({\n    required String secret,\n    required String issuer,\n    Duration accessTokenExpiry = const Duration(minutes: 15),\n  })  : _secret = secret,\n        _issuer = issuer,\n        _accessTokenExpiry = accessTokenExpiry;\n\n  String generateAccessToken(User user) {\n    final now = DateTime.now();\n    final payload = {\n      'sub': user.id,\n      'role': user.role.name,\n      'iat': now.millisecondsSinceEpoch ~\/ 1000,\n      'exp': now.add(_accessTokenExpiry).millisecondsSinceEpoch ~\/ 1000,\n      'iss': _issuer,\n      \n    };\n\n    return _sign(payload);\n  }\n\n  Result<jwtclaims appexception=\"\"> validateToken(String token) {\n    try {\n      final claims = _verifyAndDecode(token);\n\n      final exp = claims['exp'] as int;\n      if (DateTime.fromMillisecondsSinceEpoch(exp * 1000).isBefore(DateTime.now())) {\n        return Result.failure(AppException.unauthorized('Token has expired'));\n      }\n\n      if (claims['iss'] != _issuer) {\n        return Result.failure(AppException.unauthorized('Invalid token issuer'));\n      }\n\n      return Result.success(JwtClaims.fromMap(claims));\n    } on SignatureVerificationException {\n      return Result.failure(AppException.unauthorized('Invalid token signature'));\n    } catch (e) {\n      return Result.failure(AppException.unauthorized('Token validation failed'));\n    }\n  }\n}\n<\/jwtclaims><\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">public class JwtService\n{\n    private readonly JwtSettings _settings;\n\n    public string GenerateAccessToken(User user)\n    {\n        var securityKey = new SymmetricSecurityKey(\n            Encoding.UTF8.GetBytes(_settings.Secret)\n        );\n\n       \n        var credentials = new SigningCredentials(\n            securityKey,\n            SecurityAlgorithms.HmacSha256\n        );\n\n        var claims = new[]\n        {\n            new Claim(JwtRegisteredClaimNames.Sub, user.Id),\n            new Claim(ClaimTypes.Role, user.Role.ToString()),\n            new Claim(JwtRegisteredClaimNames.Iat,\n                DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString()),\n           \n        };\n\n        var token = new JwtSecurityToken(\n            issuer: _settings.Issuer,\n            audience: _settings.Audience,\n            claims: claims,\n            expires: DateTime.UtcNow.AddMinutes(15),\n            signingCredentials: credentials\n        );\n\n        return new JwtSecurityTokenHandler().WriteToken(token);\n    }\n}\n<\/code><\/pre>\n<h3 id=\"heading-jwt-failure-modes\">JWT \u0646\u0627\u06a9\u0627\u0645\u06cc \u0645\u0648\u0688<\/h3>\n<p>\u062c\u0628 \u0635\u062d\u06cc\u062d \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0644\u0627\u06af\u0648 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2 \u062a\u0648 JWT \u0628\u06c1\u062a\u0631\u06cc\u0646 \u06c1\u06d2\u06d4 \u063a\u0644\u0637 \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0646\u0627\u0641\u0630 \u06a9\u06cc\u0627 \u06af\u06cc\u0627\u060c \u06cc\u06c1 \u062a\u0628\u0627\u06c1 \u06a9\u0646 \u06c1\u0648 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u062a\u0645\u0627\u0645 \u0646\u0627\u06a9\u0627\u0645\u06cc\u0627\u06ba \u0646\u0641\u0627\u0630 \u06a9\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc\u0627\u06ba \u06c1\u06cc\u06ba\u060c \u0645\u0639\u06cc\u0627\u0631\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc\u0627\u06ba \u0646\u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u06a9\u0686\u06be \u06c1\u06d2 \u062c\u0648 \u0645\u06cc\u06ba \u0646\u06d2 \u062f\u06cc\u06a9\u06be\u0627 \u06c1\u06d2 \u06a9\u06c1 \u062d\u0642\u06cc\u0642\u06cc \u0645\u0633\u0627\u0626\u0644 \u067e\u06cc\u062f\u0627 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<h4 id=\"heading-1-the-algorithm-confusion-attack\">1. \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u06a9\u0646\u0641\u06cc\u0648\u0698\u0646 \u062d\u0645\u0644\u06c1<\/h4>\n<p>JWT \u06c1\u06cc\u0688\u0631 \u062f\u0633\u062a\u062e\u0637 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u0633\u0631\u0648\u0631 \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0637\u0644\u0648\u0628\u06c1 \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u06a9\u0648 \u0642\u0628\u0648\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u062d\u0645\u0644\u06c1 \u0622\u0648\u0631 \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u06a9\u0648 \u0627\u0633 \u067e\u0631 \u0633\u06cc\u0679 \u06a9\u0631\u062a\u0627 \u06c1\u06d2: <code>none<\/code> \u062f\u0633\u062a\u062e\u0637 \u06a9\u0648 \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u06c1\u0679\u0627 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u0633\u0631\u0648\u0631 \u062a\u0645\u0627\u0645 \u0679\u0648\u06a9\u0646\u0632 \u06a9\u0648 \u062f\u0631\u0633\u062a \u062a\u0633\u0644\u06cc\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h4 id=\"heading-2-weak-signing-secrets\">2. \u06a9\u0645\u0632\u0648\u0631 \u062f\u0633\u062a\u062e\u0637\u06cc \u0631\u0627\u0632<\/h4>\n<p>\u06a9\u0645\u0632\u0648\u0631 JWT \u0631\u0627\u0632\u0648\u06ba \u06a9\u0648 \u0632\u0628\u0631\u062f\u0633\u062a\u06cc \u0622\u0641 \u0644\u0627\u0626\u0646 \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u062d\u0645\u0644\u06c1 \u0622\u0648\u0631 \u06a9\u0648 \u0633\u0631\u0648\u0631 \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0648\u06c1 \u0679\u0648\u06a9\u0646 \u0644\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u0633\u06d2 \u06a9\u0631\u06cc\u06a9\u0631 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0686\u0644\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0631\u0627\u0632 \u062f\u0631\u06cc\u0627\u0641\u062a \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 \u0627\u0628 \u0645\u0637\u0644\u0648\u0628\u06c1 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u062c\u0648 \u0628\u06be\u06cc \u0679\u0648\u06a9\u0646 \u0686\u0627\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0633 \u067e\u0631 \u062f\u0633\u062a\u062e\u0637 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u06a9\u0645 \u0627\u0632 \u06a9\u0645 256 \u0628\u0679\u0633 \u06a9\u0627 \u0645\u0636\u0628\u0648\u0637 \u0627\u0646\u06a9\u0631\u067e\u0634\u0646 \u0633\u06cc\u06a9\u0631\u0679 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0646\u062a\u06c1\u0627\u0626\u06cc \u0645\u062d\u0641\u0648\u0638 \u0633\u06cc\u0627\u0642 \u0648 \u0633\u0628\u0627\u0642 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u063a\u06cc\u0631 \u0645\u062a\u0646\u0627\u0633\u0628 \u06a9\u0644\u06cc\u062f\u0648\u06ba \u06a9\u06d2 \u0633\u0627\u062a\u06be RS256 \u06cc\u0627 ES256 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<h4 id=\"heading-3-no-expiry\">3. \u06a9\u0648\u0626\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0626\u06cc\u06d4<\/h4>\n<p>\u062c\u06d2 \u0688\u0628\u0644\u06cc\u0648 \u0679\u06cc \u06a9\u06d2 \u0628\u063a\u06cc\u0631 <code>exp<\/code> \u062f\u0639\u0648\u06cc\u0670 \u06a9\u0628\u06be\u06cc \u0628\u0627\u0637\u0644 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u06af\u0627\u06d4 \u06c1\u0645\u06cc\u0634\u06c1 \u0627\u06cc\u06a9 \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e \u0645\u0642\u0631\u0631 \u06a9\u0631\u06cc\u06ba\u06d4 \u0642\u0644\u06cc\u0644 \u0627\u0644\u0645\u062f\u062a \u0631\u0633\u0627\u0626\u06cc \u06a9\u06d2 \u0679\u0648\u06a9\u0646\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c 15 \u0645\u0646\u0679 \u0633\u06d2 1 \u06af\u06be\u0646\u0679\u06c1 \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u06cc\u06ba\u06d4 \u0631\u06cc\u0641\u0631\u06cc\u0634 \u0679\u0648\u06a9\u0646 \u0633\u06cc\u0634\u0646 \u06a9\u06d2 \u062a\u0633\u0644\u0633\u0644 \u06a9\u0648 \u0633\u0646\u0628\u06be\u0627\u0644\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h4 id=\"heading-4-sensitive-data-in-the-payload\">4. \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u062d\u0633\u0627\u0633 \u0688\u06cc\u0679\u0627<\/h4>\n<p>\u067e\u06d2 \u0644\u0648\u0688 \u063a\u06cc\u0631 \u0627\u0646\u06a9\u0631\u067e\u0679\u0688 \u0627\u0648\u0631 \u0628\u06cc\u0633 64 \u0627\u0646\u06a9\u0648\u0688 \u0634\u062f\u06c1 \u06c1\u06d2\u06d4 \u062c\u0648 \u0628\u06be\u06cc \u0679\u0648\u06a9\u0646 \u062d\u0627\u0635\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0648\u06c1 \u0627\u0646\u062f\u0631 \u06a9\u06cc \u06c1\u0631 \u0686\u06cc\u0632 \u06a9\u0648 \u0688\u06a9\u0631\u067e\u0679 \u0627\u0648\u0631 \u067e\u0691\u06be \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 JWT \u067e\u06d2 \u0644\u0648\u0688 \u0645\u06cc\u06ba \u067e\u0627\u0633 \u0648\u0631\u0688\u060c \u0645\u06a9\u0645\u0644 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0646\u0645\u0628\u0631\u060c BVN\u060c \u06cc\u0627 \u062d\u0633\u0627\u0633 PII \u062f\u0631\u062c \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2\u060c \u0627\u06cc\u06a9 \u0634\u0646\u0627\u062e\u062a \u06a9\u0646\u0646\u062f\u06c1 \u0688\u0627\u0644\u06cc\u06ba\u06d4 \u0627\u067e\u0646\u06d2 \u0633\u0631\u0648\u0631\u0632 \u06a9\u0648 \u062d\u0633\u0627\u0633 \u0688\u06cc\u0679\u0627 \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u06d2 \u062f\u06cc\u06ba\u06d4<\/p>\n<h4 id=\"heading-5-no-revocation-strategy\">5. \u0648\u0627\u067e\u0633\u06cc \u06a9\u06cc \u06a9\u0648\u0626\u06cc \u062d\u06a9\u0645\u062a \u0639\u0645\u0644\u06cc \u0646\u06c1\u06cc\u06ba\u06d4<\/h4>\n<p>JWTs \u0628\u06d2 \u0648\u0637\u0646 \u06c1\u06cc\u06ba\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u0633\u0631\u0648\u0631 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062f\u06c1 \u0679\u0648\u06a9\u0646 \u06a9\u0648 \u0679\u0631\u06cc\u06a9 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0686\u0648\u0631\u06cc \u0634\u062f\u06c1 \u0679\u0648\u06a9\u0646 \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u062a\u06a9 \u062f\u0631\u0633\u062a \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u062d\u0644: \u0648\u0627\u0636\u062d \u0637\u0648\u0631 \u067e\u0631 \u0645\u0646\u0633\u0648\u062e \u0634\u062f\u06c1 \u0679\u0648\u06a9\u0646\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0679\u0648\u06a9\u0646 \u0628\u0644\u06cc\u06a9 \u0644\u0633\u0679 \u06a9\u0648 \u0628\u0631\u0642\u0631\u0627\u0631 \u0631\u06a9\u06be \u06a9\u0631 \u06cc\u0627 \u0631\u06cc\u0641\u0631\u06cc\u0634 \u0679\u0648\u06a9\u0646 \u0631\u0648\u0679\u06cc\u0634\u0646 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0645\u062e\u062a\u0635\u0631 \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0646\u0642\u0635\u0627\u0646 \u06a9\u06cc \u06a9\u06be\u0691\u06a9\u06cc \u06a9\u0648 \u06a9\u0645 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-when-to-use-jwts\">JWT \u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0628\u0691\u06d2 \u067e\u06cc\u0645\u0627\u0646\u06d2 \u067e\u0631 \u0627\u0633\u0679\u06cc\u0679 \u0644\u06cc\u0633 APIs\u060c \u0645\u0627\u0626\u06cc\u06a9\u0631\u0648 \u0633\u0631\u0648\u0633\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba \u062c\u06c1\u0627\u06ba \u0633\u0631\u0648\u0633 \u06a9\u0648 \u0645\u0631\u06a9\u0632\u06cc \u062a\u0635\u062f\u06cc\u0642\u06cc \u0633\u0631\u0648\u0631\u060c \u0627\u0648\u0631 \u0645\u0648\u0628\u0627\u0626\u0644 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646\u0632 \u06a9\u0648 \u06a9\u0627\u0644 \u06a9\u06cc\u06d2 \u0628\u063a\u06cc\u0631 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u067e\u0646\u06cc \u0634\u0646\u0627\u062e\u062a \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u0646\u06cc \u06c1\u0648\u06af\u06cc\u06d4 \u06cc\u06c1 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0633\u0633\u0679\u0645 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0648\u0632\u0648\u06ba \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u0627\u0633\u0679\u06cc\u0679 \u0644\u06cc\u0633 \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06cc \u067e\u06cc\u0645\u0627\u0626\u0634 \u0679\u0648\u06a9\u0646 \u0645\u0646\u0633\u0648\u062e\u06cc \u06a9\u06d2 \u0627\u0646\u062a\u0638\u0627\u0645 \u06a9\u06cc \u067e\u06cc\u0686\u06cc\u062f\u06af\u06cc \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0627\u06c1\u0645 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-5-oauth-20\">5. OAuth 2.0<\/h2>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>OAuth 2.0 \u0627\u06cc\u06a9 \u062a\u0635\u062f\u06cc\u0642\u06cc \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9 \u06c1\u06d2\u060c \u062a\u0635\u062f\u06cc\u0642\u06cc \u067e\u0631\u0648\u0679\u0648\u06a9\u0648\u0644 \u0646\u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u062a\u06cc\u0633\u0631\u06d2 \u0641\u0631\u06cc\u0642 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u067e\u0646\u06d2 \u067e\u0627\u0633 \u0648\u0631\u0688 \u0634\u06cc\u0626\u0631 \u06a9\u06cc\u06d2 \u0628\u063a\u06cc\u0631 \u0641\u0631\u06cc\u0642 \u062b\u0627\u0644\u062b \u0627\u06cc\u067e\u0644\u06cc \u06a9\u06cc\u0634\u0646\u0632 \u06a9\u0648 \u0627\u067e\u0646\u06d2 \u0648\u0633\u0627\u0626\u0644 \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u062f\u06cc\u0646\u06d2 \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0622\u067e \u0646\u06d2 \u0627\u0633 \u062e\u0635\u0648\u0635\u06cc\u062a \u06a9\u0648 \u06c1\u0631 \u0628\u0627\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627 \u06c1\u06d2 \u062c\u0628 \u0622\u067e Google \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u06a9\u0633\u06cc \u0627\u06cc\u067e \u0645\u06cc\u06ba \u0633\u0627\u0626\u0646 \u0627\u0646 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u06cc\u0627 \u062c\u0628 \u0628\u06be\u06cc \u0622\u067e \u06a9\u0648 &quot;\u0627\u0633 \u0627\u06cc\u067e \u06a9\u0648 \u0627\u067e\u0646\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u06ba&#8221; \u0646\u0638\u0631 \u0622\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633 \u0645\u06cc\u06ba \u0686\u0627\u0631 \u0641\u0631\u06cc\u0642 \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba: \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u0646\u06d2 \u0648\u0627\u0644\u0627 \u0633\u0631\u0648\u0631 \u062c\u0648 \u0679\u0648\u06a9\u0646 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0631\u06cc\u0633\u0648\u0631\u0633 \u0633\u0631\u0648\u0631 \u062c\u0648 \u0645\u062d\u0641\u0648\u0638 API \u06a9\u06cc \u0645\u06cc\u0632\u0628\u0627\u0646\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u06a9\u0644\u0627\u0626\u0646\u0679\u060c \u062c\u0648 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06cc \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0648\u0633\u0627\u0626\u0644 \u06a9\u0627 \u0645\u0627\u0644\u06a9\u060c \u062c\u0648 \u0635\u0627\u0631\u0641 \u06c1\u06d2\u06d4<\/p>\n<p>\u062a\u0635\u062f\u06cc\u0642\u06cc \u06a9\u0648\u0688 \u06a9\u0627 \u0628\u06c1\u0627\u0624 \u0627\u0633 \u0637\u0631\u062d \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2:<\/p>\n<ol>\n<li>\n<p>\u06a9\u0644\u0627\u0626\u0646\u0679 \u0635\u0627\u0631\u0641 \u06a9\u0648 \u0627\u06cc\u06a9 \u0645\u062e\u0635\u0648\u0635 \u062f\u0627\u0626\u0631\u06c1 \u06a9\u0627\u0631 \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0633\u0631\u0648\u0631 \u067e\u0631 \u0628\u06be\u06cc\u062c\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0635\u0627\u0631\u0641 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u062f\u06c1 \u062f\u0627\u0626\u0631\u06c1 \u06a9\u0627\u0631 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0627\u0648\u0631 \u0645\u0646\u0638\u0648\u0631\u06cc \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u0646\u06d2 \u0648\u0627\u0644\u0627 \u0633\u0631\u0648\u0631 \u0627\u062c\u0627\u0632\u062a \u06a9\u06d2 \u06a9\u0648\u0688 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u06a9\u0644\u0627\u0626\u0646\u0679 \u06a9\u0648 \u0648\u0627\u067e\u0633 \u0628\u06be\u06cc\u062c\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u06a9\u0644\u0627\u0626\u0646\u0679 \u0633\u0631\u0648\u0631 \u0633\u0627\u0626\u06cc\u0688 \u067e\u0631 \u0631\u0633\u0627\u0626\u06cc \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u06a9\u0648\u0688 \u06a9\u0627 \u062a\u0628\u0627\u062f\u0644\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u06a9\u0644\u0627\u0626\u0646\u0679 \u0631\u06cc\u0633\u0648\u0631\u0633 \u0633\u0631\u0648\u0631 \u06a9\u0648 \u06a9\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0631\u0633\u0627\u0626\u06cc \u0679\u0648\u06a9\u0646 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0688\u0627\u0631\u0679:<\/strong><\/p>\n<pre><code class=\"language-dart\">class OAuthClient {\n  final String _clientId;\n  final String _clientSecret;\n  final String _redirectUri;\n  final String _authorizationEndpoint;\n  final String _tokenEndpoint;\n\n  OAuthClient({\n    required String clientId,\n    required String clientSecret,\n    required String redirectUri,\n    required String authorizationEndpoint,\n    required String tokenEndpoint,\n  })  : _clientId = clientId,\n        _clientSecret = clientSecret,\n        _redirectUri = redirectUri,\n        _authorizationEndpoint = authorizationEndpoint,\n        _tokenEndpoint = tokenEndpoint;\n\n  String buildAuthorizationUrl(List<string> scopes) {\n   \n    final state = _generateSecureState();\n\n    final params = {\n      'response_type': 'code',\n      'client_id': _clientId,\n      'redirect_uri': _redirectUri,\n      'scope': scopes.join(' '),\n      'state': state,\n    };\n\n    final uri = Uri.parse(_authorizationEndpoint)\n        .replace(queryParameters: params);\n\n    return uri.toString();\n  }\n\n  Future<result appexception=\"\">> exchangeCodeForTokens(\n    String code,\n    String state,\n    String expectedState,\n  ) async {\n   \n    if (state != expectedState) {\n      return Result.failure(\n        AppException.unauthorized('Invalid state parameter'),\n      );\n    }\n\n    final response = await http.post(\n      Uri.parse(_tokenEndpoint),\n      headers: {'Content-Type': 'application\/x-www-form-urlencoded'},\n      body: {\n        'grant_type': 'authorization_code',\n        'code': code,\n        'redirect_uri': _redirectUri,\n        'client_id': _clientId,\n        'client_secret': _clientSecret,\n      },\n    );\n\n    if (response.statusCode != 200) {\n      return Result.failure(AppException.unauthorized('Token exchange failed'));\n    }\n\n    final tokens = OAuthTokens.fromJson(jsonDecode(response.body));\n    return Result.success(tokens);\n  }\n\n  String _generateSecureState() {\n    final bytes = List<int>.generate(32, (_) => Random.secure().nextInt(256));\n    return base64Url.encode(bytes);\n  }\n}\n<\/int><\/result><\/string><\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">builder.Services.AddAuthentication(options =>\n{\n    options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;\n    options.DefaultChallengeScheme = \"OAuth2\";\n})\n.AddCookie()\n.AddOAuth(\"OAuth2\", options =>\n{\n    options.ClientId = builder.Configuration[\"OAuth:ClientId\"]!;\n    options.ClientSecret = builder.Configuration[\"OAuth:ClientSecret\"]!;\n    options.CallbackPath = \"\/auth\/callback\";\n    options.AuthorizationEndpoint = \"https:\/\/auth.provider.com\/authorize\";\n    options.TokenEndpoint = \"https:\/\/auth.provider.com\/token\";\n    options.SaveTokens = true;\n    options.Scope.Add(\"openid\");\n    options.Scope.Add(\"profile\");\n\n    options.Events = new OAuthEvents\n    {\n        OnCreatingTicket = async context =>\n        {\n            var userInfoRequest = new HttpRequestMessage(\n                HttpMethod.Get,\n                \"https:\/\/auth.provider.com\/userinfo\"\n            );\n            userInfoRequest.Headers.Authorization =\n                new AuthenticationHeaderValue(\"Bearer\", context.AccessToken);\n\n            var response = await context.Backchannel.SendAsync(userInfoRequest);\n            var userInfo = await response.Content.ReadFromJsonAsync<jsondocument>();\n\n            context.Identity!.AddClaim(new Claim(\n                ClaimTypes.NameIdentifier,\n                userInfo!.RootElement.GetString(\"sub\")!\n            ));\n        }\n    };\n});\n<\/jsondocument><\/code><\/pre>\n<h3 id=\"heading-oauth-20-failure-modes\">OAuth 2.0 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u06d2 \u0645\u0648\u0688\u0632<\/h3>\n<h4 id=\"heading-1-misconfigured-redirect-uris\">1. \u063a\u0644\u0637 \u062a\u0631\u062a\u06cc\u0628 \u0634\u062f\u06c1 \u0631\u06cc \u0688\u0627\u0626\u0631\u06cc\u06a9\u0679 URI<\/h4>\n<p>\u0627\u06af\u0631 \u062a\u0648\u062b\u06cc\u0642\u06cc \u0633\u0631\u0648\u0631 \u0631\u06cc \u0688\u0627\u0626\u0631\u06cc\u06a9\u0679 URIs \u06a9\u06cc \u0633\u062e\u062a\u06cc \u0633\u06d2 \u062a\u0648\u062b\u06cc\u0642 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u062d\u0645\u0644\u06c1 \u0622\u0648\u0631 \u0627\u067e\u0646\u06d2 URIs \u06a9\u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u062a\u0635\u062f\u06cc\u0642\u06cc \u06a9\u0648\u0688 \u06a9\u0648 \u0631\u0648\u06a9 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u0633 \u0633\u06d2 \u0628\u0686\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0639\u06cc\u0646 \u0645\u0637\u0627\u0628\u0642 \u0645\u06cc\u0686 \u0686\u06cc\u06a9\u0646\u06af \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<h4 id=\"heading-2-tokens-in-urls\">2. URL \u0645\u06cc\u06ba \u0679\u0648\u06a9\u0646<\/h4>\n<p>\u0631\u0633\u0627\u0626\u06cc \u0679\u0648\u06a9\u0646\u0632 \u0633\u0631\u0648\u0631 \u0644\u0627\u06af\u060c \u0628\u0631\u0627\u0624\u0632\u0631 \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e\u060c \u06cc\u0627 \u062d\u0648\u0627\u0644\u06c1 \u062f\u06cc\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u06c1\u06cc\u0688\u0631 \u0645\u06cc\u06ba \u0638\u0627\u06c1\u0631 \u06c1\u0648 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u06a9\u0648\u0626\u06cc \u0627\u0646\u06c1\u06cc\u06ba \u062a\u0635\u062f\u06cc\u0642\u06cc \u06c1\u06cc\u0688\u0631 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u06a9\u06d2 \u067e\u06cc\u0631\u0627\u0645\u06cc\u0679\u0631\u0632 \u0645\u06cc\u06ba \u0631\u06a9\u06be\u062a\u0627 \u06c1\u06d2\u06d4 \u0679\u0648\u06a9\u0646 \u06a9\u0627 \u062a\u0639\u0644\u0642 \u0627\u062c\u0627\u0632\u062a \u06a9\u06d2 \u06c1\u06cc\u0688\u0631 \u0633\u06d2 \u06c1\u06d2\u06d4 URL \u0644\u0627\u06af \u0645\u06cc\u06ba \u0638\u0627\u06c1\u0631 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0627 \u06c1\u06cc\u0688\u0631 \u0646\u06c1\u06cc\u06ba \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-when-to-use-oauth-20\">OAuth 2.0 \u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u06cc\u06c1 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0645\u0646\u0638\u0631 \u0646\u0627\u0645\u06d2 \u0645\u06cc\u06ba \u0627\u0686\u06be\u06cc \u0637\u0631\u062d \u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u0622\u067e \u06a9\u0648 \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u0648\u0633\u0627\u0626\u0644 \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u062a\u06cc\u0633\u0631\u06d2 \u0641\u0631\u06cc\u0642 \u06a9\u0648 \u0633\u0648\u0646\u067e\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u060c \u0628\u0634\u0645\u0648\u0644 \u0633\u0645\u0627\u062c\u06cc \u0644\u0627\u06af \u0627\u0646\u060c \u06a9\u0631\u0627\u0633 \u0622\u0631\u06af\u0646\u0627\u0626\u0632\u06cc\u0634\u0646 API \u0627\u0646\u0636\u0645\u0627\u0645\u060c \u0627\u0648\u0631 \u067e\u0627\u0631\u0679\u0646\u0631 \u0633\u0633\u0679\u0645 \u0627\u0646\u0679\u06cc\u06af\u0631\u06cc\u0634\u0646\u06d4<\/p>\n<h2 id=\"heading-6-openid-connect-oidc\">6. \u0627\u0648\u067e\u0646 \u0622\u0626\u06cc \u0688\u06cc \u06a9\u0646\u06cc\u06a9\u0679 (OIDC)<\/h2>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>OAuth 2.0 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0648 \u06c1\u06cc\u0646\u0688\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 OpenID Connect OAuth 2.0 \u06a9\u06d2 \u0627\u0648\u067e\u0631 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0627 \u0627\u0636\u0627\u0641\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06c1\u0645 \u0622\u067e \u06a9\u0648 \u0635\u0631\u0641 \u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u0628\u062a\u0627\u062a\u06d2 \u06a9\u06c1 \u0622\u067e \u06a9\u06cc\u0627 \u0645\u0646\u0638\u0648\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u062f\u0631\u0627\u0635\u0644 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0635\u0627\u0631\u0641 \u06a9\u0648\u0646 \u06c1\u06d2\u06d4<\/p>\n<p>OIDC \u0631\u0633\u0627\u0626\u06cc \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u06cc\u06a9 ID \u0679\u0648\u06a9\u0646 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 ID \u0679\u0648\u06a9\u0646 \u0627\u06cc\u06a9 JWT \u06c1\u06d2 \u062c\u0633 \u0645\u06cc\u06ba \u062a\u0635\u062f\u06cc\u0642 \u0634\u062f\u06c1 \u0634\u0646\u0627\u062e\u062a\u06cc \u062f\u0639\u0648\u06d2 \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba\u060c \u0628\u0634\u0645\u0648\u0644 \u0645\u0648\u0636\u0648\u0639 \u06a9\u0627 \u0634\u0646\u0627\u062e\u062a \u06a9\u0646\u0646\u062f\u06c1\u060c \u0627\u06cc \u0645\u06cc\u0644\u060c \u0646\u0627\u0645\u060c \u067e\u0631\u0648\u0641\u0627\u0626\u0644 \u062a\u0635\u0648\u06cc\u0631\u060c \u0627\u0648\u0631 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0628 \u06c1\u0648\u0626\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0688\u0627\u0631\u0679:<\/strong><\/p>\n<pre><code class=\"language-dart\">class OidcService {\n  final String _issuer;\n  final String _clientId;\n  final JwtValidator _jwtValidator;\n\n  OidcService({\n    required String issuer,\n    required String clientId,\n    required JwtValidator jwtValidator,\n  })  : _issuer = issuer,\n        _clientId = clientId,\n        _jwtValidator = jwtValidator;\n\n  Future<result appexception=\"\">> validateIdToken(\n    String idToken,\n  ) async {\n    final claimsResult = await _jwtValidator.validate(idToken);\n    if (claimsResult.isFailure) {\n      return Result.failure(claimsResult.error!);\n    }\n\n    final claims = claimsResult.value!;\n\n    if (claims['iss'] != _issuer) {\n      return Result.failure(AppException.unauthorized('Invalid token issuer'));\n    }\n\n\n    final aud = claims['aud'];\n    final audiences = aud is List ? aud : [aud];\n    if (!audiences.contains(_clientId)) {\n      return Result.failure(\n        AppException.unauthorized('Token not intended for this client'),\n      );\n    }\n\n    return Result.success(UserIdentity(\n      subject: claims['sub'] as String,\n      email: claims['email'] as String?,\n      name: claims['name'] as String?,\n      emailVerified: claims['email_verified'] as bool? ?? false,\n    ));\n  }\n}\n<\/result><\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">builder.Services.AddAuthentication(options =>\n{\n    options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;\n    options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;\n})\n.AddCookie()\n.AddOpenIdConnect(options =>\n{\n    options.Authority = \"https:\/\/accounts.google.com\";\n    options.ClientId = builder.Configuration[\"OIDC:ClientId\"]!;\n    options.ClientSecret = builder.Configuration[\"OIDC:ClientSecret\"]!;\n    options.ResponseType = \"code\";\n    options.Scope.Add(\"openid\");\n    options.Scope.Add(\"profile\");\n    options.Scope.Add(\"email\");\n    options.SaveTokens = true;\n    options.GetClaimsFromUserInfoEndpoint = true;\n\n    options.TokenValidationParameters = new TokenValidationParameters\n    {\n        ValidateIssuer = true,\n        ValidateAudience = true,\n        ValidateLifetime = true,\n        NameClaimType = \"name\",\n        RoleClaimType = \"role\"\n    };\n});\n<\/code><\/pre>\n<h3 id=\"heading-when-to-use-oidc\">OIDC \u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u06a9\u0633\u06cc \u0628\u06be\u06cc \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u062b\u0627\u0644\u06cc \u06c1\u06d2 \u062c\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u0634\u0646\u0627\u062e\u062a \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0646\u0646\u062f\u06c1\u060c \u062c\u06cc\u0633\u06d2 \u06a9\u06c1 \u0627\u0646\u0679\u0631\u067e\u0631\u0627\u0626\u0632 SSO \u06cc\u0627 \u0633\u0648\u0634\u0644 \u0644\u0627\u06af \u0627\u0646 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0635\u0627\u0631\u0641 \u06a9\u06cc \u0634\u0646\u0627\u062e\u062a \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u06d4 \u06cc\u06c1 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0627\u06cc\u0633\u06d2 \u0646\u0638\u0627\u0645 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0648\u0632\u0648\u06ba \u06c1\u06d2 \u062c\u0648 \u0635\u0627\u0631\u0641 \u06a9\u06cc \u0627\u0633\u0646\u0627\u062f \u06a9\u0648 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u0645\u0646\u0638\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u06a9\u0633\u06cc \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u062a\u06cc\u0633\u0631\u06d2 \u0641\u0631\u06cc\u0642 \u06a9\u0648 \u0634\u0646\u0627\u062e\u062a \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0633\u0648\u0646\u067e\u0646\u0627 \u0686\u0627\u06c1\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>Google \u0633\u0627\u0626\u0646 \u0627\u0646\u060c Microsoft Azure AD\u060c Okta\u060c \u0627\u0648\u0631 Auth0 \u0633\u0628\u06be\u06cc OIDC \u06a9\u0648 \u0646\u0627\u0641\u0630 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u0622\u067e \u06a9\u0627 \u0633\u0648\u0627\u0644 \u0635\u0631\u0641 &quot;\u06a9\u06cc\u0627 \u06cc\u06c1 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0645\u0646\u0638\u0648\u0631 \u06c1\u06d2&#8221; \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u0628\u0644\u06a9\u06c1 &quot;\u06cc\u06c1 \u0634\u062e\u0635 \u06a9\u0648\u0646 \u06c1\u06d2\u061f&#8221; \u067e\u06be\u0631 OIDC \u0635\u062d\u06cc\u062d \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-7-mutual-tls-mtls\">7. \u0628\u0627\u06c1\u0645\u06cc TLS (mTLS)<\/h2>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u0633\u0627\u062f\u06c1 TLS \u0645\u06cc\u06ba\u060c \u06a9\u0644\u0627\u0626\u0646\u0679 \u0633\u0631\u0648\u0631 \u06a9\u06d2 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0633\u0631\u0648\u0631 \u06a9\u0633\u06cc \u0628\u06be\u06cc \u06a9\u0644\u0627\u0626\u0646\u0679 \u067e\u0631 \u0628\u06be\u0631\u0648\u0633\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0648\u06c1 \u06a9\u0646\u06a9\u0634\u0646 \u0642\u0627\u0626\u0645 \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0628\u0627\u06c1\u0645\u06cc TLS \u0645\u06cc\u06ba\u060c \u062f\u0648\u0646\u0648\u06ba \u0641\u0631\u06cc\u0642 \u0627\u06cc\u06a9 \u062f\u0648\u0633\u0631\u06d2 \u06a9\u06d2 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679\u0633 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0633\u0631\u0648\u0631 \u0635\u0631\u0641 \u0627\u0646 \u06a9\u0644\u0627\u0626\u0646\u0679\u0633 \u0633\u06d2 \u06a9\u0646\u06a9\u0634\u0646 \u0642\u0628\u0648\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u0627\u062a\u06be\u0627\u0631\u0679\u06cc \u06a9\u06cc \u0637\u0631\u0641 \u0633\u06d2 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062f\u06c1 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06a9\u0644\u0627\u0626\u0646\u0679 \u0627\u067e\u0646\u06cc \u0634\u0646\u0627\u062e\u062a \u0646\u06c1\u06cc\u06ba \u0628\u0646\u0627 \u0633\u06a9\u062a\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0627\u0646\u06c1\u06cc\u06ba \u062d\u0642\u06cc\u0642\u06cc \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u06a9\u0648\u0626\u06cc \u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646 \u06cc\u0627 API \u06a9\u0644\u06cc\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u0627\u06cc\u06a9 \u062a\u0635\u062f\u06cc\u0642 \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0688\u0627\u0631\u0679 (\u06a9\u0644\u0627\u0626\u0646\u0679 \u0633\u0627\u0626\u0688 mTLS):<\/strong><\/p>\n<pre><code class=\"language-dart\">class MtlsHttpClient {\n  final http.Client _client;\n\n  MtlsHttpClient._internal(this._client);\n\n  static Future<mtlshttpclient> create({\n    required String certificatePath,\n    required String privateKeyPath,\n    required String trustedCaPath,\n  }) async {\n    final context = SecurityContext(withTrustedRoots: false);\n\n    \/\/ load the client certificate\n    context.useCertificateChainBytes(\n      await File(certificatePath).readAsBytes(),\n    );\n\n    \/\/ load the client private key\n    context.usePrivateKeyBytes(\n      await File(privateKeyPath).readAsBytes(),\n    );\n\n    \/\/ only trust this specific CA\n    context.setTrustedCertificatesBytes(\n      await File(trustedCaPath).readAsBytes(),\n    );\n\n    final httpClient = HttpClient(context: context);\n    final client = IOClient(httpClient);\n\n    return MtlsHttpClient._internal(client);\n  }\n\n  Future<http.response> get(String url, {Map<string string=\"\">? headers}) {\n    return _client.get(Uri.parse(url), headers: headers);\n  }\n\n  Future<http.response> post(\n    String url, {\n    Map<string string=\"\">? headers,\n    Object? body,\n  }) {\n    return _client.post(Uri.parse(url), headers: headers, body: body);\n  }\n}\n<\/string><\/http.response><\/string><\/http.response><\/mtlshttpclient><\/code><\/pre>\n<p><strong>aspirate#:<\/strong><\/p>\n<pre><code class=\"language-csharp\">builder.WebHost.ConfigureKestrel(options =>\n{\n    options.ConfigureHttpsDefaults(httpsOptions =>\n    {\n        httpsOptions.ClientCertificateMode = ClientCertificateMode.RequireCertificate;\n        httpsOptions.ClientCertificateValidation = (certificate, chain, errors) =>\n        {\n            if (errors != SslPolicyErrors.None)\n                return false;\n\n            var expectedThumbprint = \"your-trusted-cert-thumbprint\";\n            return certificate.Thumbprint == expectedThumbprint;\n        };\n    });\n});\n\npublic class MtlsMiddleware\n{\n    private readonly RequestDelegate _next;\n\n    public async Task InvokeAsync(HttpContext context)\n    {\n        var clientCert = context.Connection.ClientCertificate;\n\n        if (clientCert == null)\n        {\n            context.Response.StatusCode = 401;\n            await context.Response.WriteAsync(\"Client certificate required\");\n            return;\n        }\n\n        if (!IsValidClientCertificate(clientCert))\n        {\n            context.Response.StatusCode = 403;\n            await context.Response.WriteAsync(\"Invalid client certificate\");\n            return;\n        }\n\n        await _next(context);\n    }\n\n    private bool IsValidClientCertificate(X509Certificate2 cert)\n    {\n        if (cert.NotAfter < DateTime.UtcNow) return false;\n\n        var trustedThumbprints = new HashSet<string>\n        {\n            \"THUMBPRINT_SERVICE_A\",\n            \"THUMBPRINT_SERVICE_B\",\n        };\n\n        return trustedThumbprints.Contains(cert.Thumbprint);\n    }\n}\n<\/string><\/code><\/pre>\n<h3 id=\"heading-the-real-problem-with-mtls\">mTLS \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0635\u0644 \u0645\u0633\u0626\u0644\u06c1<\/h3>\n<p>\u06cc\u06c1\u0627\u06ba \u0645\u0633\u0626\u0644\u06c1 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u06a9\u06d2 \u0627\u0646\u062a\u0638\u0627\u0645 \u06a9\u0627 \u06c1\u06d2\u06d4 \u0622\u067e \u06a9\u06d2 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679 \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648 \u0631\u06c1\u06cc \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u06af\u0631\u062f\u0634 \u062e\u0648\u062f\u06a9\u0627\u0631 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u062a\u0648\u060c \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679\u0633 \u0628\u062f\u062a\u0631\u06cc\u0646 \u0645\u0645\u06a9\u0646\u06c1 \u0644\u0645\u062d\u06d2 \u0645\u06cc\u06ba \u062e\u062f\u0645\u0627\u062a \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u0631\u0627\u0628\u0637\u06d2 \u06a9\u0648 \u062a\u0648\u0691 \u062f\u06cc\u06ba \u06af\u06d2\u06d4 CA \u06a9\u0627 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06c1 \u062e\u0648\u062f \u0645\u062d\u0641\u0648\u0638 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u0633\u0645\u062c\u06be\u0648\u062a\u06c1 \u0634\u062f\u06c1 CA \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u062a\u0645\u0627\u0645 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062f\u06c1 \u0633\u0631\u0679\u06cc\u0641\u06a9\u06cc\u0679\u0633 \u0633\u06d2 \u0633\u0645\u062c\u06be\u0648\u062a\u06c1 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0645\u06a9\u0645\u0644 PKI \u06a9\u0648 \u0645\u0646\u0638\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0622\u067e\u0631\u06cc\u0634\u0646\u0644 \u0635\u0644\u0627\u062d\u06cc\u062a\u0648\u06ba \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u0679\u06cc\u0645\u0648\u06ba \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0633\u062e\u062a \u0688\u0648\u0645\u06cc\u0646 \u0648\u0627\u0626\u0679 \u0644\u0633\u0679 \u0627\u0648\u0631 \u06af\u0631\u062f\u0634\u06cc \u0634\u06cc\u0688\u0648\u0644 \u06a9\u06d2 \u0633\u0627\u062a\u06be API \u06a9\u06cc\u0632 \u0632\u06cc\u0627\u062f\u06c1 \u0639\u0645\u0644\u06cc \u062c\u0648\u0627\u0628 \u06c1\u0648 \u0633\u06a9\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 mTLS \u0627\u06cc\u06a9 \u0635\u062d\u06cc\u062d \u0641\u0646 \u062a\u0639\u0645\u06cc\u0631 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0635\u062d\u06cc\u062d \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u0627 \u0633\u0628 \u0633\u06d2 \u0645\u0634\u06a9\u0644 \u0641\u0646 \u062a\u0639\u0645\u06cc\u0631 \u0628\u06be\u06cc \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-when-to-use-mtls\">\u0627\u06cc\u0645 \u0679\u06cc \u0627\u06cc\u0644 \u0627\u06cc\u0633 \u06a9\u0628 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/h3>\n<p>\u0627\u0646\u062a\u06c1\u0627\u0626\u06cc \u0645\u062d\u0641\u0648\u0638 \u062e\u062f\u0645\u0627\u062a\u060c \u062c\u06cc\u0633\u06d2 \u06a9\u06c1 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06d2 \u06af\u06cc\u0679 \u0648\u06cc\u0632 \u06cc\u0627 \u0628\u06cc\u0646\u06a9\u0646\u06af APIs \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u0645\u0648\u0627\u0635\u0644\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 mTLS \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0631\u06cc\u06af\u0648\u0644\u06cc\u0679\u0688 \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u0645\u0627\u0626\u06cc\u06a9\u0631\u0648 \u0633\u0631\u0648\u0633\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u06be\u06cc \u0645\u062b\u0627\u0644\u06cc \u06c1\u06d2 \u062c\u0646 \u06a9\u06cc \u062a\u0639\u0645\u06cc\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0679\u0631\u0627\u0646\u0633\u067e\u0648\u0631\u0679 \u06a9\u06cc \u067e\u0631\u062a \u067e\u0631 \u062e\u0641\u06cc\u06c1 \u0634\u0646\u0627\u062e\u062a\u06cc \u062b\u0628\u0648\u062a \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u0627\u0646\u062a\u06c1\u0627\u0626\u06cc \u0645\u062d\u0641\u0648\u0638 \u0646\u0638\u0627\u0645 \u0645\u06cc\u06ba\u060c \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u062e\u062f\u0645\u0627\u062a \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u062a\u0645\u0627\u0645 \u0645\u0648\u0627\u0635\u0644\u0627\u062a \u06a9\u0648 \u062d\u0633\u0627\u0633 \u0633\u0645\u062c\u06be\u0627 \u062c\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 mTLS \u0648\u06c1 \u0628\u0646\u06cc\u0627\u062f \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-choosing-the-right-mechanism\">\u0635\u062d\u06cc\u062d \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628<\/h2>\n<p>\u062a\u0635\u062f\u06cc\u0642 \u06a9\u06d2 \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u0627\u06cc\u06a9 \u062a\u0639\u0645\u06cc\u0631\u0627\u062a\u06cc \u0641\u06cc\u0635\u0644\u06c1 \u06c1\u06d2\u06d4 \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9 \u0645\u0646\u062f\u0631\u062c\u06c1 \u0630\u06cc\u0644 \u06c1\u06d2:<\/p>\n<p><strong>\u0635\u0627\u0631\u0641 \u06a9\u0627 \u0633\u0627\u0645\u0646\u0627 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06cc \u0648\u06cc\u0628 \u0627\u0648\u0631 \u0645\u0648\u0628\u0627\u0626\u0644 \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2:<\/strong> JWT \u06a9\u06d2 \u0628\u0637\u0648\u0631 \u0628\u06cc\u0626\u0631\u0631 \u0679\u0648\u06a9\u0646 \u0645\u0646\u062a\u062e\u0628 \u06a9\u0631\u06cc\u06ba\u06d4 \u06cc\u06c1 \u06af\u06be\u0648\u0645\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0631\u06cc\u0641\u0631\u06cc\u0634 \u0679\u0648\u06a9\u0646 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u06cc\u06a9 \u0645\u062e\u062a\u0635\u0631 \u0645\u062f\u062a \u062a\u06a9 \u0631\u0633\u0627\u0626\u06cc \u06a9\u0627 \u0679\u0648\u06a9\u0646 \u06c1\u06d2\u06d4 \u062a\u0645\u0627\u0645 \u062a\u0635\u062f\u06cc\u0642\u06cc \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u067e\u0648\u0627\u0626\u0646\u0679\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0634\u0631\u062d \u06a9\u0648 \u0645\u062d\u062f\u0648\u062f \u06a9\u0631\u0646\u0627\u06d4<\/p>\n<p><strong>\u062a\u06cc\u0633\u0631\u06d2 \u0641\u0631\u06cc\u0642 \u06a9\u06cc \u062a\u0641\u0648\u06cc\u0636 \u06a9\u0631\u062f\u06c1 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2:<\/strong> OAuth 2.0 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u0622\u067e \u06a9\u0648 \u0628\u06be\u06cc \u0635\u0627\u0631\u0641 \u06a9\u06cc \u0634\u0646\u0627\u062e\u062a \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2 \u062a\u0648 \u0633\u0628 \u0633\u06d2 \u0627\u0648\u067e\u0631 OIDC \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u0627\u0646\u0679\u0631\u067e\u0631\u0627\u0626\u0632 SSO \u06a9\u06d2 \u0644\u06cc\u06d2:<\/strong> \u0627\u067e\u0646\u06d2 \u0627\u0646\u0679\u0631\u067e\u0631\u0627\u0626\u0632 \u0634\u0646\u0627\u062e\u062a \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0646\u0646\u062f\u06c1 \u06a9\u06d2 \u0633\u0627\u062a\u06be OpenID Connect \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u06a9\u0645 \u0633\u0631\u0648\u0631 \u0633\u06d2 \u0633\u0631\u0648\u0631 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06a9\u06cc \u0636\u0631\u0648\u0631\u06cc\u0627\u062a\u06d4<\/strong> \u0688\u0648\u0645\u06cc\u0646 \u0648\u0627\u0626\u0679 \u0644\u0633\u0679\u060c \u0645\u0627\u062d\u0648\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u062e\u0635\u0648\u0635 \u06a9\u06cc\u0632\u060c \u0627\u0648\u0631 \u0637\u06d2 \u0634\u062f\u06c1 \u06af\u0631\u062f\u0634 \u06a9\u06d2 \u0633\u0627\u062a\u06be API \u06a9\u06cc\u0632 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u0627\u06cc\u06a9 \u0631\u06cc\u06af\u0648\u0644\u06cc\u0679\u0688\u060c \u06c1\u0627\u0626\u06cc \u0633\u06cc\u06a9\u0648\u0631\u0679\u06cc \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u062e\u062f\u0645\u0627\u062a \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646:<\/strong> mTLS \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u0645\u0636\u0628\u0648\u0637\u06cc \u0633\u06d2 \u06a9\u0646\u0679\u0631\u0648\u0644 \u0634\u062f\u06c1 \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u0679\u0648\u0644\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2:<\/strong> \u0628\u0646\u06cc\u0627\u062f\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0635\u0631\u0641 \u0627\u0633 \u0635\u0648\u0631\u062a \u0645\u06cc\u06ba \u0645\u0645\u06a9\u0646 \u06c1\u06d2 \u062c\u0628 TLS \u06a9\u06cc \u0636\u0645\u0627\u0646\u062a \u06c1\u0648\u06d4 \u0628\u0627\u0642\u06cc \u0633\u0628 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0645\u0636\u0628\u0648\u0637 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p>\u0622\u067e \u06a9\u0648 \u06a9\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u0627 \u06a9\u0648\u0646 \u06c1\u06d2\u060c \u0688\u06cc\u0679\u0627 \u06a9\u06cc \u062d\u0633\u0627\u0633\u06cc\u062a \u06a9\u06cc\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0622\u067e \u06a9\u06cc \u062a\u0639\u0645\u06cc\u0644 \u06a9\u06d2 \u062a\u0642\u0627\u0636\u06d2 \u06a9\u06cc\u0627 \u06c1\u06cc\u06ba \u0627\u0633 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u067e\u0631 \u0622\u067e \u06a9\u0648 \u0627\u06cc\u06a9 \u062a\u0635\u062f\u06cc\u0642\u06cc \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u06cc\u06c1 \u06a9\u0648\u0626\u06cc \u06a9\u0646\u0648\u0646\u0634\u0646 \u06cc\u0627 \u06a9\u0648\u0626\u06cc \u0686\u06cc\u0632 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u062c\u0633\u06d2 \u0645\u06cc\u06ba \u0646\u06d2 \u0627\u067e\u0646\u06d2 \u0622\u062e\u0631\u06cc \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0627\u06d4 \u0644\u0627\u06af\u0648 \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0633\u0628 \u0633\u06d2 \u0622\u0633\u0627\u0646 \u0637\u0631\u06cc\u0642\u06c1 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2.<\/p>\n<h2 id=\"heading-the-organizational-discipline-that-ties-everything-together\">\u062a\u0646\u0638\u06cc\u0645\u06cc \u0646\u0638\u0645 \u0648 \u0636\u0628\u0637 \u062c\u0648 \u06c1\u0631 \u0686\u06cc\u0632 \u06a9\u0648 \u0622\u067e\u0633 \u0645\u06cc\u06ba \u062c\u0648\u0691\u062a\u0627 \u06c1\u06d2\u06d4<\/h2>\n<p>\u0679\u06a9\u0646\u0627\u0644\u0648\u062c\u06cc \u06a9\u06d2 \u0646\u0641\u0627\u0630 \u06a9\u0648 \u062f\u0631\u0633\u062a \u06a9\u0631\u0646\u0627 \u0622\u062f\u06be\u0627 \u06a9\u0627\u0645 \u06c1\u06d2\u06d4 \u0628\u0627\u0642\u06cc \u0646\u0635\u0641 \u062a\u0646\u0638\u06cc\u0645\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>API \u06a9\u0644\u06cc\u062f\u06cc \u06af\u0631\u062f\u0634\u0648\u06ba \u06a9\u0648 \u0634\u06cc\u0688\u0648\u0644 \u0627\u0648\u0631 \u0641\u0639\u0627\u0644 \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u0626\u06d2\u060c \u0646\u06c1 \u06a9\u06c1 \u0645\u0634\u062a\u0628\u06c1 \u062e\u0644\u0627\u0641 \u0648\u0631\u0632\u06cc \u06a9\u0627 \u0631\u062f\u0639\u0645\u0644\u06d4 \u06c1\u0631 \u06a9\u0644\u06cc\u062f \u06a9\u0627 \u0627\u06cc\u06a9 \u0645\u062a\u0639\u06cc\u0646 \u0632\u06cc\u0627\u062f\u06c1 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0644\u0627\u0626\u0641 \u0679\u0627\u0626\u0645 \u0627\u0648\u0631 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0646\u06af \u06a9\u06cc \u0645\u0644\u06a9\u06cc\u062a \u0645\u06cc\u06ba \u06af\u0631\u062f\u0634 \u06a9\u0627 \u0634\u06cc\u0688\u0648\u0644 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>API \u06a9\u06cc\u0632 \u0645\u062a\u0639\u062f\u062f \u06a9\u0644\u0627\u0626\u0646\u0679\u0633 \u06cc\u0627 \u0645\u062a\u0639\u062f\u062f \u0645\u0627\u062d\u0648\u0644 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u06a9\u0627\u0645 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 \u0627\u0633\u0679\u06cc\u062c\u0646\u06af \u06a9\u0644\u06cc\u062f \u0627\u06cc\u06a9 \u0627\u0633\u0679\u06cc\u062c\u0646\u06af \u06a9\u0644\u06cc\u062f \u06c1\u06d2\u06d4 \u0645\u0648\u0628\u0627\u0626\u0644 \u06a9\u0644\u0627\u0626\u0646\u0679 \u06a9\u06cc \u06a9\u0644\u06cc\u062f \u0645\u0648\u0628\u0627\u0626\u0644 \u06a9\u0644\u0627\u0626\u0646\u0679 \u06a9\u06cc \u06c1\u06d2\u06d4 \u067e\u0648\u0631\u06d2 \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u06a9\u0644\u06cc\u062f\u06cc \u062f\u0648\u0628\u0627\u0631\u06c1 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06a9\u06cc \u062d\u062f\u0648\u062f \u06a9\u0648 \u062a\u0648\u0691\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0631\u0627\u0632 \u0645\u0627\u062e\u0630 \u06a9\u0648\u0688\u060c \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u0648\u0688\u060c \u06cc\u0627 \u0631\u06cc\u067e\u0648\u0632\u0679\u0631\u06cc \u0633\u06d2 \u0648\u0627\u0628\u0633\u062a\u06c1 \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u0641\u0627\u0626\u0644\u0648\u06ba \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u0631\u0646 \u0679\u0627\u0626\u0645 \u06a9\u06d2 \u0648\u0642\u062a \u0627\u06cc\u06a9 \u0642\u0627\u0628\u0644 \u0627\u0639\u062a\u0645\u0627\u062f \u062e\u0641\u06cc\u06c1 \u0645\u06cc\u0646\u06cc\u062c\u0631 \u0633\u06d2 \u0631\u0627\u0632 \u062d\u0627\u0635\u0644 \u06a9\u06cc\u06d2 \u062c\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0646\u06af \u06a9\u0627 \u0645\u0639\u06cc\u0627\u0631 \u06c1\u06d2\u060c \u062a\u0631\u062c\u06cc\u062d \u0646\u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u0646\u06a9\u0631\u067e\u0634\u0646 \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u0622\u067e \u06a9\u06cc \u062a\u0646\u0638\u06cc\u0645 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u0645\u0639\u06cc\u0627\u0631\u06cc \u06c1\u0648\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u060c \u0646\u06c1 \u06a9\u06c1 \u0627\u06cc\u0633\u06cc \u0686\u06cc\u0632 \u062c\u0633 \u06a9\u0627 \u0641\u06cc\u0635\u0644\u06c1 \u0688\u0648\u06cc\u0644\u067e\u0631\u0632 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0628\u06c1 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u067e\u0631 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633\u0679\u0627\u0641 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631 \u06cc\u0627 \u0622\u0631\u06a9\u06cc\u0679\u06cc\u06a9\u0679 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u06a9\u0648\u0626\u06cc \u0641\u0631\u062f \u062a\u0646\u0638\u06cc\u0645 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06c1 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062f\u06c1 \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645\u060c \u0637\u0631\u06cc\u0642\u0648\u06ba \u0627\u0648\u0631 \u06a9\u0644\u06cc\u062f\u06cc \u0644\u0645\u0628\u0627\u0626\u06cc \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u062a\u0645\u0627\u0645 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u0645\u0639\u06cc\u0627\u0631\u0627\u062a \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0688\u0648\u06cc\u0644\u067e\u0631\u0632 \u0627\u06cc\u06a9 \u067e\u0631\u0627\u062c\u06cc\u06a9\u0679 \u0628\u06c1 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u067e\u0631 \u0634\u0631\u0648\u0639 \u0633\u06d2 \u062e\u0641\u06cc\u06c1 \u06a9\u0627\u0631\u06cc \u06a9\u0648 \u0644\u0627\u06af\u0648 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u062f\u0627\u0631\u0648\u06ba \u06a9\u0648 \u06a9\u0631\u067e\u0679\u0648\u06af\u0631\u0627\u0641\u06a9 \u0622\u067e\u0631\u06cc\u0634\u0646\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0645\u0634\u062a\u0631\u06a9\u06c1 \u067e\u06cc\u06a9\u062c\u0632 \u0628\u0646\u0627\u0646\u0627 \u0627\u0648\u0631 \u0628\u0631\u0642\u0631\u0627\u0631 \u0631\u06a9\u06be\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u0688\u0648\u06cc\u0644\u067e\u0631 \u067e\u06cc\u06a9\u062c \u062f\u0631\u0622\u0645\u062f \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0648\u06c1 \u062e\u0648\u062f \u062e\u0641\u06cc\u06c1 \u06a9\u0627\u0631\u06cc \u0646\u06c1\u06cc\u06ba \u0644\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0627\u06cc\u0688\u06c1\u0627\u06a9 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u06cc \u0648\u062c\u06c1 \u0633\u06d2 \u062e\u0641\u06cc\u06c1 \u06a9\u0627\u0631\u06cc \u06a9\u06d2 \u0646\u0641\u0627\u0630 \u06a9\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc\u0648\u06ba \u06a9\u06d2 \u067e\u0648\u0631\u06d2 \u0632\u0645\u0631\u06d2 \u06a9\u0648 \u062e\u062a\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0641\u06cc\u0644\u0688 \u0644\u06cc\u0648\u0644 \u0645\u0627\u0633\u06a9\u0646\u06af \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0633\u0679\u0631\u06a9\u0686\u0631\u0688 \u0644\u0627\u06af\u0646\u06af \u06a9\u0648 \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0644\u0627\u06af\u0648 \u06a9\u06cc\u0627 \u062c\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06d2 \u06c1\u06cc\u0688\u0631\u060c \u0679\u0648\u06a9\u0646\u060c \u067e\u0627\u0633 \u0648\u0631\u0688\u060c \u0627\u06a9\u0627\u0624\u0646\u0679 \u0646\u0645\u0628\u0631\u060c \u0627\u0648\u0631 \u062d\u0633\u0627\u0633 \u0641\u06cc\u0644\u0688\u0632 \u06a9\u0628\u06be\u06cc \u0628\u06be\u06cc \u06a9\u0633\u06cc \u0628\u06be\u06cc \u0645\u0627\u062d\u0648\u0644 (\u067e\u0631\u0648\u0688\u06a9\u0634\u0646\u060c \u0633\u0679\u06cc\u062c\u0646\u06af\u060c \u06cc\u0627 \u0688\u06cc\u0648\u0644\u067e\u0645\u0646\u0679) \u06a9\u06d2 \u0644\u0627\u06af \u0645\u06cc\u06ba \u0638\u0627\u06c1\u0631 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0646\u06d2 \u0686\u0627\u06c1\u0626\u06cc\u06ba\u06d4 \u0645\u0627\u0633\u06a9\u0646\u06af \u0644\u0627\u06af\u0646\u06af \u0641\u0631\u06cc\u0645 \u0648\u0631\u06a9 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0644\u0627\u06af\u0648 \u06a9\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2\u060c \u0644\u06c1\u0630\u0627 \u0627\u0646\u0641\u0631\u0627\u062f\u06cc \u0688\u0648\u06cc\u0644\u067e\u0631\u0632 \u063a\u0644\u0637\u06cc \u0633\u06d2 \u062d\u0633\u0627\u0633 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0644\u0627\u06af \u0627\u0646 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u0686\u0627\u06c1\u06d2 \u0648\u06c1 \u06a9\u0648\u0634\u0634 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-conclusion\">\u0646\u062a\u06cc\u062c\u06c1<\/h2>\n<p>\u0627\u0633 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u062a\u0645\u0627\u0645 \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645 \u06a9\u0627\u0645 \u06a9\u0631\u06cc\u06ba \u06af\u06d2 \u0627\u06af\u0631 \u062f\u0631\u0633\u062a \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0644\u0627\u06af\u0648 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4 \u0627\u06cc\u06a9 \u06c1\u06cc \u0648\u0642\u062a \u0645\u06cc\u06ba\u060c \u0627\u06af\u0631 \u063a\u0644\u0637 \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0644\u0627\u06af\u0648 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u062a\u0645\u0627\u0645 \u0645\u06cc\u06a9\u0627\u0646\u0632\u0645 \u067e\u06cc\u0634 \u06af\u0648\u0626\u06cc \u0627\u0648\u0631 \u062f\u0633\u062a\u0627\u0648\u06cc\u0632\u06cc \u0637\u0631\u06cc\u0642\u0648\u06ba \u0645\u06cc\u06ba \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u062c\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 JWT \u0627\u0644\u06af\u0648\u0631\u062a\u06be\u0645 \u06a9\u0646\u0641\u06cc\u0648\u0698\u0646 \u0627\u0679\u06cc\u06a9 \u06a9\u06d2 \u0646\u062a\u06cc\u062c\u06d2 \u0645\u06cc\u06ba \u0627\u0635\u0644 \u062a\u0648\u062b\u06cc\u0642 \u0628\u0627\u0626\u06cc \u067e\u0627\u0633 \u06c1\u0648\u0626\u06cc\u06d4 \u063a\u0644\u0637 \u06a9\u0646\u0641\u06cc\u06af\u0631 \u0634\u062f\u06c1 OAuth \u0631\u06cc \u0688\u0627\u0626\u0631\u06cc\u06a9\u0679 URI \u06a9\u06cc \u0648\u062c\u06c1 \u0633\u06d2 \u062d\u0642\u06cc\u0642\u06cc \u062f\u0646\u06cc\u0627 \u06a9\u0627 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0679\u06cc\u06a9 \u0627\u0648\u0648\u0631 \u06c1\u0648\u0627\u06d4 \u0644\u0627\u067e\u062a\u06c1 \u0627\u0633\u0679\u06cc\u0679 \u067e\u06cc\u0631\u0627\u0645\u06cc\u0679\u0631 \u0646\u06d2 \u0627\u06cc\u06a9 \u062d\u0642\u06cc\u0642\u06cc CSRF \u062d\u0645\u0644\u06d2 \u06a9\u0648 \u0641\u0639\u0627\u0644 \u06a9\u06cc\u0627\u06d4 \u062f\u0633\u062a\u062e\u0637 \u06a9\u06cc \u06a9\u0645\u0632\u0648\u0631\u06cc \u06a9\u06cc \u0648\u062c\u06c1 \u0633\u06d2 \u0628\u0691\u06d2 \u067e\u06cc\u0645\u0627\u0646\u06d2 \u067e\u0631 \u062d\u0642\u06cc\u0642\u06cc \u062f\u0646\u06cc\u0627 \u06a9\u06cc \u0646\u0642\u0627\u0644\u06cc \u06c1\u0648\u0626\u06cc \u06c1\u06d2\u06d4 \u0631\u06cc\u067e\u0648\u0632\u0679\u0631\u06cc \u0645\u06cc\u06ba \u06c1\u0627\u0631\u0688 \u06a9\u0648\u0688 \u0634\u062f\u06c1 API \u06a9\u06cc\u0632 \u0646\u06d2 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0633\u0633\u0679\u0645 \u06a9\u0648 \u063a\u06cc\u0631 \u0645\u062c\u0627\u0632 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u06d2 \u0646\u0642\u0627\u0628 \u06a9\u06cc\u0627\u06d4<\/p>\n<p>\u06cc\u06c1 \u0646\u0638\u0631\u06cc\u0627\u062a\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u0627 \u0645\u0648\u0688 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1 \u062a\u0645\u0627\u0645 \u0633\u0627\u0626\u0632 \u06a9\u06cc \u062a\u0646\u0638\u06cc\u0645\u0648\u06ba \u0645\u06cc\u06ba \u067e\u06cc\u062f\u0627\u0648\u0627\u0631\u06cc \u0646\u0638\u0627\u0645 \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2\u06d4 \u0648\u06c1 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631 \u062c\u0646\u06c1\u0648\u06ba \u0646\u06d2 \u06cc\u06c1 \u0646\u0638\u0627\u0645 \u0628\u0646\u0627\u06cc\u0627 \u0648\u06c1 \u0646\u0627\u0627\u06c1\u0644 \u0646\u06c1\u06cc\u06ba \u062a\u06be\u06d2\u06d4 \u0627\u0646\u06c1\u0648\u06ba \u0646\u06d2 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u06d2 \u0637\u0631\u06cc\u0642\u0648\u06ba \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u0633\u0646\u0627 \u06c1\u06d2\u06d4 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u062a\u0646\u0638\u06cc\u0645\u06cc \u0645\u0639\u06cc\u0627\u0631\u0627\u062a \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06cc\u0627 \u067e\u0627\u0626\u067e \u0644\u0627\u0626\u0646 \u0645\u06cc\u06ba \u0627\u0646 \u06a9\u0648 \u0646\u0627\u0641\u0630 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0631\u06c1\u0627 \u062a\u06be\u0627\u06d4<\/p>\n<p>\u0627\u0646\u062c\u06cc\u0646\u0626\u0631\u0646\u06af \u0688\u0633\u067e\u0644\u0646 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0622\u067e \u06a9\u0648\u0688 \u06a9\u06cc \u067e\u06c1\u0644\u06cc \u0644\u0627\u0626\u0646 \u0644\u06a9\u06be\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06cc\u06c1 \u062c\u0627\u0646\u0646\u0627 \u06a9\u06c1 \u06c1\u0631 \u0637\u0631\u06cc\u0642\u06c1 \u06a9\u0627\u0631 \u06a9\u0633 \u0637\u0631\u062d \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0627\u0646 \u0646\u0627\u06a9\u0627\u0645\u06cc \u0637\u0631\u06cc\u0642\u0648\u06ba \u06a9\u0648 \u0634\u0631\u0648\u0639 \u0633\u06d2 \u0631\u0648\u06a9\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u067e\u0646\u06d2 \u0646\u0641\u0627\u0630 \u06a9\u0648 \u062a\u06cc\u0627\u0631 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u0641\u0631\u0642 \u06c1\u06d2 \u062c\u0648 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u062a\u0648\u062b\u06cc\u0642 \u062c\u0648 \u0645\u062e\u0627\u0644\u0641 \u062d\u0627\u0644\u0627\u062a \u0645\u06cc\u06ba \u0632\u0646\u062f\u06c1 \u0631\u06c1\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0645\u0628\u0627\u0631\u06a9 \u06a9\u0648\u0688\u0646\u06af!<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u06c1\u0631 API \u06a9\u06d2 \u067e\u0627\u0633 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u06a9\u0686\u06be \u0634\u06a9\u0644 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u0644\u06cc\u06a9\u0646 \u0633\u0646\u062f \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u0627 \u0627\u0648\u0631 \u0627\u0633\u06d2 \u062f\u0631\u0633\u062a \u06a9\u0631\u0646\u0627 \u062f\u0648 \u0628\u0627\u0644\u06a9\u0644 \u0645\u062e\u062a\u0644\u0641 \u0686\u06cc\u0632\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u06c1\u0645 \u0646\u06d2 \u0627\u06cc\u06a9 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0633\u0633\u0679\u0645 \u06a9\u0627 \u062c\u0627\u0626\u0632\u06c1 \u0644\u06cc\u0627 \u062c\u06c1\u0627\u06ba JWTs \u06a9\u06cc \u0645\u06cc\u0639\u0627\u062f \u062e\u062a\u0645 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0626\u06cc \u062a\u06be\u06cc\u06d4 \u0627\u06cc\u06a9 \u0627\u06cc\u0633\u0627 \u0646\u0638\u0627\u0645 \u062c\u06c1\u0627\u06ba API \u06a9\u06cc\u0632 \u06a9\u0648 \u0633\u0648\u0631\u0633 \u06a9\u0648\u0688 \u0645\u06cc\u06ba \u06c1\u0627\u0631\u0688 \u06a9\u0648\u0688 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-30417","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/30417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/comments?post=30417"}],"version-history":[{"count":0,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/30417\/revisions"}],"wp:attachment":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/media?parent=30417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/categories?post=30417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/tags?post=30417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}