{"id":1949,"date":"2021-07-06T02:59:06","date_gmt":"2021-07-06T09:59:06","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/"},"modified":"2021-07-06T02:59:06","modified_gmt":"2021-07-06T09:59:06","slug":"oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/ko\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/","title":{"rendered":"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]"},"content":{"rendered":"<p><strong>Couchbase Sync Gateway supports<\/strong> <a href=\"https:\/\/openid.net\/connect\/\" rel=\"noopener\" target=\"_blank\">OpenID Connect or OIDC-based client authentication<\/a>. <\/p>\n\n\n\n<p>In this context, <em>clients<\/em> may be Couchbase Lite clients that synchronize data with Sync Gateway over the Internet using <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/sync-using-app.html?ref=blog\" rel=\"noopener\" target=\"_blank\">the websockets-based replication protocol<\/a> or they could be web frontend or mobile apps accessing Sync Gateway through the <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/sync-using-app.html?ref=blog\" rel=\"noopener\" target=\"_blank\">public REST endpoint<\/a>.<\/p>\n\n\n\n<p>In the first blog post in this series, we discussed <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/oauth-2-oidc-fundamentals-authentication-authorization\/?ref=blog\" rel=\"noopener\" target=\"_blank\">the fundamentals of OIDC and OAuth2 authentication and authorization flows<\/a> and in last week&#8217;s blog post, we learned more in-depth about <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/oidc-implicit-flow-client-authentication-couchbase-sync-gateway\/?ref=blog\" rel=\"noopener\" target=\"_blank\">OIDC implicit flow-based Sync Gateway client authentication<\/a>.<\/p>\n\n\n\n<p>In this post, I&#8217;ll introduce you to <a href=\"https:\/\/openid.net\/specs\/openid-connect-core-1_0.html#CodeFlowAuth\" rel=\"noopener\" target=\"_blank\">OIDC authorization code flow-based<\/a> client authentication within the context of Couchbase Sync Gateway replication. <\/p>\n\n\n\n<p>This post assumes familiarity with OIDC and OAuth2 flows for authentication and authorization. If you&#8217;re unfamiliar with the flows or need a refresher, please check out the earlier blog posts linked above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Couchbase Sync Gateway OIDC Configuration<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/products\/sync-gateway\/?ref=blog\" rel=\"noopener\" target=\"_blank\">Couchbase Sync Gateway<\/a> must be configured for OIDC authentication <em>on a per database basis<\/em>.<\/p>\n\n\n\n<p>Below is a basic OIDC config for Authorization Code. Refer to the official Couchbase documentation for <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/configuration-properties.html?ref=blog#databases-this_db-oidc\" rel=\"noopener\" target=\"_blank\">a complete listing of all OIDC config options<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\n&quot;oidc&quot;: {\r\n          &quot;default_provider&quot;:&quot;google&quot;,\r\n          &quot;providers&quot;: {\r\n            &quot;google&quot;: {\r\n                &quot;issuer&quot;:&quot;https:\/\/accounts.google.com&quot;,\r\n                &quot;client_id&quot;:&quot;YOUR_CLIENT_ID&quot;,\r\n                &quot;validation_key&quot;:&quot;YOUR_CLIENT_SECRET&quot;,\r\n                &quot;callback_url&quot;:&quot;https:\/\/SYNC_GATEWAY_ADDRESS:4984\/default\/_oidc_callback&quot;,\r\n                &quot;register&quot;:true,\r\n                &quot;username_claim&quot;:&quot;email&quot;,\r\n                &quot;disable_session&quot;:false\r\n            }\r\n          }\r\n        }\r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Couchbase Sync Gateway OIDC Discovery<\/h2>\n\n\n\n<p>On startup, the Sync Gateway connects to <a href=\"https:\/\/openid.net\/specs\/openid-connect-discovery-1_0.html#IssuerDiscovery\" rel=\"noopener\" target=\"_blank\">the discovery endpoint associated with the configured OIDC provider\/issuer<\/a> to fetch relevant provider metadata. The <a href=\"https:\/\/openid.net\/specs\/openid-connect-discovery-1_0.html#ProviderConfigurationResponse\" rel=\"noopener\" target=\"_blank\">metadata includes relevant information required for token validation<\/a> such as issuer public keys, supported encryption algorithms used for encoding the claims in the ID token, etc.<\/p>\n\n\n\n<p>The discovery endpoint corresponds to a well-known discovery URL associated with the issuer. If needed, you can override the URL via <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/current\/configuration-properties.html?ref=blog#databases-this_db-oidc-providers-this_provider-discovery_url\" rel=\"noopener\" target=\"_blank\">Sync Gateway discovery_url config option<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">OIDC Authorization Code Flow for Client Authentication<\/h2>\n\n\n\n<p>This flow is based on the standard OIDC authorization code flow discussed in <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/oauth-2-oidc-fundamentals-authentication-authorization\/?ref=blog\" rel=\"noopener\" target=\"_blank\">the OIDC basics blog (part one of the series)<\/a>. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Authentication<\/h3>\n\n\n\n<p><a href=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/user-authentication-oidc-couchbase-sync-gateway.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/user-authentication-oidc-couchbase-sync-gateway.png\" alt=\"An example of user authentication using OIDC and Couchbase Sync Gateway\" width=\"800\" height=\"449\" class=\"aligncenter size-full wp-image-11498\"><\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>When a user logs into the Couchbase Lite client app, the client invokes the <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/rest-api-admin.html?ref=blog#\/auth\/get__db___oidc\" rel=\"noopener\" target=\"_blank\">_oidc REST endpoint<\/a> on Sync Gateway to initiate the OIDC Auth Code flow.<\/li>\n\n\n<li>Sync Gateway redirects the client app to the OIDC provider URL.<\/li>\n\n\n<li>The client initiates the authorization code flow with the OIDC provider to retrieve the authorization code. This is per standard OIDC flow procedures outlined in <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/oauth-2-oidc-fundamentals-authentication-authorization\/?ref=blog\" rel=\"noopener\" target=\"_blank\">the OIDC basics blog<\/a>.<\/li>\n\n\n<li>The client is redirected to the Sync Gateway with the authorization code. The redirect URL corresponds to <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/current\/rest-api-admin.html?ref=blog#\/auth\/get__db___oidc_callback\" rel=\"noopener\" target=\"_blank\">the OIDC callback REST endpoint<\/a>.<\/li>\n\n\n<li>The client app invokes the OIDC callback REST endpoint with the authorization code.<\/li>\n\n\n<li>The Sync Gateway exchanges the code for the ID token, the refresh token, and the access token by sending a suitable request to the OIDC provider. The request includes the <code>client_id<\/code> and <code>client_secret<\/code> which were configured on Sync Gateway. This allows the OIDC provider to validate that only trusted clients are able to retrieve the tokens.<\/li>\n\n\n<li>Sync Gateway validates the ID token locally. Following successful token validation, a corresponding <code>UserCtx<\/code> object is created.\n<ul>\n<li>The metadata retrieved from the OIDC Provider Discovery URL during startup is used to validate the token in &#8220;offline mode.&#8221;<\/li>\n<li>If this is the first time that the user is authenticating with the Sync Gateway and if a corresponding user does not exist on the server, the Sync Gateway automatically creates a user if the <code>register<\/code> config option is set to <code>true<\/code>.\n<ul>\n<li><strong>Note:<\/strong> The user that is created is not associated with any access grants such as <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/channels.html?ref=blog\" rel=\"noopener\" target=\"_blank\">channels<\/a> or <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/roles.html?ref=blog\" rel=\"noopener\" target=\"_blank\">roles<\/a>, so this auto registration would work for public users with no user-specific access grants. We will discuss a flow later in this post that describes how to create users with user-specific access grants.<\/li>\n<\/ul>\n<\/li>\n<li>A session is created for the user with an idle session timeout of 24 hours. The session is created <strong>ONLY IF<\/strong> the <code>disable_session<\/code> is set to false.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>The session ID and refresh tokens are sent back to the client app.<\/li>\n\n\n<li>Client app initiates a replication by <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/2.8\/swift\/replication.html?ref=blog#lbl-init-repl\" rel=\"noopener\" target=\"_blank\">setting the session ID as the session cookie using the <code>SessionAuthenticator<\/code><\/a>.<\/li>\n\n\n<li>Sync Gateway checks the validity of the session to determine if the session has been deleted or has expired.\n<ul>\n<li>If the session is active, the session gets auto-extended to 24 hours if 10% of idle session timeout has elapsed.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>Following successful initialization, replication proceeds as usual and document changes on the client app and Sync Gateway side are synchronized.\n<ul>\n<li>If the user is deleted during an active replication, the replication is terminated.<\/li>\n<li>If the access grants associated with the user have changed, then documents that get impacted by the updated access grants won\u2019t be replicated. So for instance, if a user loses access to a channel, then the documents in that channel won\u2019t be pulled.<\/li>\n<\/ul>\n<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Token Refresh<\/h3>\n\n\n\n<p>One of the advantages of the authorization code flow is that in addition to the ID token, a refresh token is also returned to the client app. The client app can use the refresh token to automatically request a new auth code without requiring the end user to reauthenticate with their login credentials.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/user-token-refresh-openid-connect-authorization-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/user-token-refresh-openid-connect-authorization-couchbase.png\" alt=\"An example of user token refresh using OpenID Connect authorization and Couchbase\" width=\"800\" height=\"447\" class=\"aligncenter size-full wp-image-11500\"><\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>When the client app wants to refresh the token, it makes a request to the OIDC refresh REST endpoint with the refresh token.<\/li>\n\n\n<li>The Sync Gateway exchanges the refresh token for the updated ID token and access token by sending a suitable request to the OIDC provider. The request includes the <code>client_id<\/code> and <code>client_secret<\/code> which were configured on Sync Gateway. This allows the OIDC Provider to validate that only trusted clients are able to retrieve the tokens.<\/li>\n\n\n<li>Sync Gateway validates the ID token locally. Following successful token validation, a corresponding <code>UserCtx<\/code> object is created.\n<ul>\n<li>The metadata retrieved from the OIDC provider discovery URL during startup is used to validate the token in &#8220;offline mode.&#8221;\n<\/li><li>A new session is created for the user with an idle session timeout of 24 hours. The session is created <strong>ONLY IF<\/strong> the <code>disable_session<\/code> is set to false.\n<\/li><\/ul>\n<\/li>\n\n\n<li>The session ID and ID tokens are sent back to the client app.<\/li>\n\n\n<li>The client app initiates a replication using session ID as the session cookie following the same steps as in the previous flow.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Associating Access Grants to Authenticated Users<\/h2>\n\n\n\n<p>Sync Gateway <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/2.8\/channels.html?ref=blog\" rel=\"noopener\" target=\"_blank\">channels<\/a> and <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/current\/roles.html\" rel=\"noopener\" target=\"_blank\">roles<\/a> are two key elements of Sync Gateway\u2019s access control mechanism. They define the <em>access grants<\/em> associated with a user, dictating the set of documents that the user has read and write access to.<\/p>\n\n\n\n<p>There are a couple of options to assign access grants to a user:<\/p>\n\n\n\n<p>As you&#8217;ve seen from the previous flows, the Couchbase Sync Gateway can be configured to automatically create the authenticated user on the Sync Gateway following successful authentication. However, the created user is not associated with any access grants. This works for a public user with public channel access.<\/p>\n\n\n\n<p>But what if you wanted to assign user-specific access grants? This task is typically handled via a backend application server that would be responsible for creating or updating the user. The Sync Gateway is only responsible for OIDC authentication.<\/p>\n\n\n\n<p>Here is a typical flow:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/user-specific-access-grants-oidc-authorization-couchbase-sync-gateway.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/user-specific-access-grants-oidc-authorization-couchbase-sync-gateway.png\" alt=\"User-specific access grants using OIDC authorization and Couchbase Sync Gateway\" width=\"800\" height=\"435\" class=\"aligncenter size-full wp-image-11499\"><\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A backend process or app server is responsible for registering users with the OIDC provider.<\/li>\n\n\n<li>Subsequent to the registration, the app server creates a corresponding user on Sync Gateway via the <code>_user REST API<\/code> or by adding a suitable access grant document.<\/li>\n\n\n<li>Next time the user logs into the app, OIDC authentication proceeds using the authorization code flow procedures described earlier.<\/li>\n\n\n<li>Regardless of the type of OIDC flow, once the ID token is validated by the Sync Gateway, the Sync Gateway does not create a user because it already exists.<\/li>\n\n\n<li>Replication proceeds as usual using the authenticated user.<\/li>\n\n\n<li>If a user is updated on the OIDC Provider, the app server updates the corresponding user on the Sync Gateway via the <code>_user REST API<\/code> or by updating the access grant document.\n<ul>\n<li>If a user is deleted during an active replication, the replication is terminated.<\/li>\n<li>If the access grants associated with the user have changed, then documents that get impacted by the updated access grants won\u2019t be replicated. For instance, if a user loses access to a channel then the documents in that channel won\u2019t be pulled.\n<\/li><\/ul>\n<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Question (FAQ)<\/h2>\n\n\n\n<p><em>Which is better: implicit flow or authorization code flow?<\/em><\/p>\n\n\n\n<p>There isn\u2019t a preferred flow from my perspective. The implicit flow is simple and is generally preferred by most of our users. Since mobile apps have a secure store, the ID and access tokens can be securely stored in the local keystore on the device. You can learn more in this blog post about <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/oidc-implicit-flow-client-authentication-couchbase-sync-gateway\/?ref=blog\" rel=\"noopener\" target=\"_blank\">how to leverage OIDC implicit flow for Sync Gateway authentication<\/a>.<\/p>\n\n\n\n<p>The advantage of the authorization code flow is that it provides slightly better security. This is because the tokens are granted to the Sync Gateway in exchange for the authorization code only when the OIDC Provider is presented with a valid <code>client_id<\/code> and <code>client_secret<\/code>. This ensures that only authenticated clients get the tokens. Also the refresh tokens allow refreshing of the auth sessions without requiring the end user to enter their credentials every time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More Resources<\/h2>\n\n\n\n<p>In this post, we described OIDC authentication support in Sync Gateway. Here are some additional resources you might want to check out:<\/p>\n\n\n\n<p>If you have questions or feedback, please leave a comment below or email me at <a href=\"mailto:priya.rajagopal@couchbase.com\">priya.rajagopal@couchbase.com<\/a>. The <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/forums\/?ref=blog\" rel=\"noopener\" target=\"_blank\">Couchbase Forums<\/a> are another good place to reach out with questions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Acknowledgements<\/h2>\n\n\n\n<p>I would like to thank Sync Gateway architect <a href=\"https:\/\/github.com\/adamcfraser\" rel=\"noopener\" target=\"_blank\">Adam Fraser<\/a> for his input on this blog post.<br>\n\u00a0<\/p>\n\n\n\n<p><em>Catch up with the rest of the posts in this series on authentication and authorization:<\/em><\/p>\n\n\n\n<p><br>\n\u00a0<br>\n\u00a0<br>\n\u00a0<\/p>","protected":false},"excerpt":{"rendered":"<p>Couchbase Sync Gateway supports OpenID Connect or OIDC-based client authentication. In this context, clients may be Couchbase Lite clients that synchronize data with Sync Gateway over the Internet using the websockets-based replication protocol or they could be web frontend or mobile apps accessing Sync Gateway through the public REST endpoint. In the first blog post [&hellip;]<\/p>\n","protected":false},"author":1423,"featured_media":1948,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[136,131,94,353,240,104],"tags":[470,484,471,473,474,440,241],"ppma_author":[252],"class_list":["post-1949","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-couchbase-lite","category-security","category-solutions","category-swift","category-sync-gateway","tag-authorization-code-flow","tag-client-authentication","tag-implicit-flow","tag-oidc","tag-openid-connect","tag-role-based-access-control","tag-swift"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]<\/title>\n<meta name=\"description\" content=\"Discover how to build and understand OpenID Connect (OIDC) authorization code flow-based client authentication within Couchbase Sync Gateway replication.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/ko\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]\" \/>\n<meta property=\"og:description\" content=\"Discover how to build and understand OpenID Connect (OIDC) authorization code flow-based client authentication within Couchbase Sync Gateway replication.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/ko\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-06T09:59:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Priya Rajagopal, Senior Director, Product Management\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rajagp\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Priya Rajagopal, Senior Director, Product Management\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/\"},\"author\":{\"name\":\"Priya Rajagopal, Senior Director, Product Management\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/c2da90e57717ee4970c48a87a131ac2c\"},\"headline\":\"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]\",\"datePublished\":\"2021-07-06T09:59:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/\"},\"wordCount\":1561,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg\",\"keywords\":[\"Authorization Code Flow\",\"Client Authentication\",\"Implicit Flow\",\"OIDC\",\"OpenID Connect\",\"Role Based Access Control (RBAC)\",\"swift\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Lite\",\"Security\",\"Solutions\",\"Swift\",\"Sync Gateway\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/\",\"name\":\"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg\",\"datePublished\":\"2021-07-06T09:59:06+00:00\",\"description\":\"Discover how to build and understand OpenID Connect (OIDC) authorization code flow-based client authentication within Couchbase Sync Gateway replication.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/c2da90e57717ee4970c48a87a131ac2c\",\"name\":\"Priya Rajagopal, Senior Director, Product Management\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g4b50a54778b979d8c345b036ab138734\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g\",\"caption\":\"Priya Rajagopal, Senior Director, Product Management\"},\"description\":\"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/rajagp\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/ko\\\/author\\\/priya-rajagopalcouchbase-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]","description":"Discover how to build and understand OpenID Connect (OIDC) authorization code flow-based client authentication within Couchbase Sync Gateway replication.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/ko\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/","og_locale":"ko_KR","og_type":"article","og_title":"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]","og_description":"Discover how to build and understand OpenID Connect (OIDC) authorization code flow-based client authentication within Couchbase Sync Gateway replication.","og_url":"https:\/\/www.couchbase.com\/blog\/ko\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-07-06T09:59:06+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg","type":"image\/jpeg"}],"author":"Priya Rajagopal, Senior Director, Product Management","twitter_card":"summary_large_image","twitter_creator":"@rajagp","twitter_misc":{"Written by":"Priya Rajagopal, Senior Director, Product Management","Est. reading time":"9\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/"},"author":{"name":"Priya Rajagopal, Senior Director, Product Management","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c"},"headline":"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]","datePublished":"2021-07-06T09:59:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/"},"wordCount":1561,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg","keywords":["Authorization Code Flow","Client Authentication","Implicit Flow","OIDC","OpenID Connect","Role Based Access Control (RBAC)","swift"],"articleSection":["Best Practices and Tutorials","Couchbase Lite","Security","Solutions","Swift","Sync Gateway"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/","url":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/","name":"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg","datePublished":"2021-07-06T09:59:06+00:00","description":"Discover how to build and understand OpenID Connect (OIDC) authorization code flow-based client authentication within Couchbase Sync Gateway replication.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/openid-connect-authorization-code-flow-client-authentication-couchbase-sync-gateway.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/oidc-authorization-code-flow-client-authentication-couchbase-sync-gateway\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"OIDC Authorization Code Flow for Client Authentication in Couchbase Sync Gateway [Part 3 of 3]"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c","name":"Priya Rajagopal, Senior Director, Product Management","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g4b50a54778b979d8c345b036ab138734","url":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","caption":"Priya Rajagopal, Senior Director, Product Management"},"description":"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.","sameAs":["https:\/\/x.com\/rajagp"],"url":"https:\/\/www.couchbase.com\/blog\/ko\/author\/priya-rajagopalcouchbase-com\/"}]}},"acf":[],"authors":[{"term_id":252,"user_id":1423,"is_guest":0,"slug":"priya-rajagopalcouchbase-com","display_name":"Priya Rajagopal, Senior Director, Product Management","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/1949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/users\/1423"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/comments?post=1949"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/1949\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media\/1948"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media?parent=1949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/categories?post=1949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/tags?post=1949"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/ppma_author?post=1949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}