{"title":"Migrate to client key","category":"default","creationDate":1590760200,"content":"<p>If your Web integration uses the <a href=\"\/development-resources\/how-to-get-an-origin-key\">origin key<\/a> or your iOS or Android integration uses the client encryption public key, switch to the client key. In future versions the client key will be the only way to do client-side authentication. The client key makes it easier for you to manage the origins for your integration.<\/p>\n<p>With the client key, you have:<\/p>\n<ul>\n<li>A single key for all your <a href=\"\/development-resources\/client-side-authentication#allowed-origins\">allowed origins<\/a> in an environment.<\/li>\n<li>Flexibility to add and remove origins without having to generate a new client key.<\/li>\n<li>A human-readable prefix, <strong>test<\/strong> or <strong>live<\/strong>, so you can easily tell which environment a client key is linked to.<\/li>\n<\/ul>\n<p>The client key also enables card type detection through <a href=\"\/get-started-with-adyen\/adyen-glossary\/#bank-identification-number-bin\">Bank Identification Number (BIN)<\/a> lookup, which is not available when using the origin key.<\/p>\n<h2 id=\"availability-compatibility\">Availability and compatibility<\/h2>\n<p>The client key is available for the following:<\/p>\n<table>\n<thead>\n<tr>\n<th>Online payments integration<\/th>\n<th>Version<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Web Drop-in and Components<\/td>\n<td>Available for 3.10.1 and later. Previous versions require <a href=\"\/development-resources\/how-to-get-an-origin-key\">origin keys<\/a> for client-side authentication. <br> Starting 4.0.0 the client key is the only way to do client-side authentication.<\/td>\n<\/tr>\n<tr>\n<td>iOS Drop-in and Components<\/td>\n<td>3.7.0 and later. <br> Previous versions require client encryption public keys. <br> Starting 4.0.0 the client key is the only way to do client-side authentication.<\/td>\n<\/tr>\n<tr>\n<td>Android Drop-in and Components<\/td>\n<td>3.7.0 and later. <br> Previous versions require client encryption public keys. <br> Starting 4.0.0 the client key is the only way to do client-side authentication.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<thead>\n<tr>\n<th>In-person payments integration<\/th>\n<th>Solutions<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>POS Mobile SDK for iOS<\/td>\n<td>Tap to Pay on iPhone <br> Card reader&mdash;iOS<\/td>\n<\/tr>\n<tr>\n<td>POS Mobile SDK for Android<\/td>\n<td>Tap to Pay on Android <br> Card reader&mdash;Android<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The client key is backwards compatible with the origin key and the public key. Generating a client key doesn't invalidate a pre-existing origin key or public key.<\/p>\n<h2>Switch to using the client key<\/h2>\n<p>To switch to using the client key, you must first generate your client key in your Customer Area:<\/p>\n<ol>\n<li>Log in to your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>.\n<ol>\n<li>Go to <strong>Developers<\/strong> &gt; <strong>API credentials<\/strong>, and select the credential username for your integration, for example <strong>ws@Company.[YourCompanyAccount]<\/strong>.<\/li>\n<li>Under <strong>Client settings<\/strong> &gt; <strong>Authentication<\/strong> select the <strong>Client key<\/strong> tab.<\/li>\n<li>Select <strong>Generate client key<\/strong>.<\/li>\n<li>Select the copy icon <i class=\"adl-icon-copy\"><\/i> and store your client key securely in your system.<\/li>\n<li>Under <strong>Add allowed origins<\/strong>, enter your <a href=\"\/development-resources\/client-side-authentication#allowed-origins\">domains<\/a> and select <strong>Add<\/strong>.<\/li>\n<li>Select <strong>Save changes<\/strong>.<\/li>\n<\/ol><\/li>\n<\/ol>\n<p>Once you have your client key, you need to add it to your integration. Choose your platform:<\/p>\n  \n<div id=\"tab5Dl1U\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;Web&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;You must be running &lt;a href=\\&quot;\\\/online-payments\\\/drop-in-web\\&quot;&gt;Web Drop-in&lt;\\\/a&gt; or &lt;a href=\\&quot;\\\/online-payments\\\/components-web\\\/\\&quot;&gt;Web Components&lt;\\\/a&gt; version 3.10.1 or above.&lt;\\\/p&gt;\\n&lt;p&gt;Replace &lt;code&gt;originKey&lt;\\\/code&gt; in your Web Drop-in or Web Components configuration object with:&lt;\\\/p&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n    &lt;code-sample :title=\\&quot;&#039;Web Components&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;js\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;const configuration = {\\\\n    ...\\\\n    clientKey: \\\\\\&quot;YOUR_CLIENT_KEY\\\\\\&quot;,\\\\n    ...\\\\n}\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n  &quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:1,&quot;relation&quot;:&quot;&quot;},{&quot;title&quot;:&quot;iOS&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;You must be running &lt;a href=\\&quot;\\\/online-payments\\\/build-your-integration\\\/sessions-flow?platform=iOS&amp;amp;integration=Drop-in\\&quot;&gt;iOS Drop-in&lt;\\\/a&gt; or &lt;a href=\\&quot;\\\/online-payments\\\/build-your-integration\\\/sessions-flow?platform=iOS&amp;amp;integration=Components\\&quot;&gt;iOS Components&lt;\\\/a&gt; version 3.7.0 or above.&lt;\\\/p&gt;\\n&lt;ol&gt;\\n&lt;li&gt;\\n&lt;p&gt;Create an instance of &lt;code&gt;APIContext&lt;\\\/code&gt; with the following parameters:&lt;\\\/p&gt;\\n&lt;table&gt;\\n&lt;thead&gt;\\n&lt;tr&gt;\\n&lt;th&gt;Parameter name&lt;\\\/th&gt;\\n&lt;th style=\\&quot;text-align: center;\\&quot;&gt;Required&lt;\\\/th&gt;\\n&lt;th&gt;Description&lt;\\\/th&gt;\\n&lt;\\\/tr&gt;\\n&lt;\\\/thead&gt;\\n&lt;tbody&gt;\\n&lt;tr&gt;\\n&lt;td&gt;&lt;code&gt;clientKey&lt;\\\/code&gt;&lt;\\\/td&gt;\\n&lt;td style=\\&quot;text-align: center;\\&quot;&gt;&lt;img title=\\&quot;-white_check_mark-\\&quot; alt=\\&quot;-white_check_mark-\\&quot; class=\\&quot;smileys\\&quot; src=\\&quot;\\\/user\\\/data\\\/smileys\\\/emoji\\\/white_check_mark.png\\&quot; \\\/&gt;&lt;\\\/td&gt;\\n&lt;td&gt;Your &lt;a href=\\&quot;\\\/development-resources\\\/client-side-authentication\\&quot;&gt;client key&lt;\\\/a&gt;.&lt;\\\/td&gt;\\n&lt;\\\/tr&gt;\\n&lt;tr&gt;\\n&lt;td&gt;&lt;code&gt;environment&lt;\\\/code&gt;&lt;\\\/td&gt;\\n&lt;td style=\\&quot;text-align: center;\\&quot;&gt;&lt;img title=\\&quot;-white_check_mark-\\&quot; alt=\\&quot;-white_check_mark-\\&quot; class=\\&quot;smileys\\&quot; src=\\&quot;\\\/user\\\/data\\\/smileys\\\/emoji\\\/white_check_mark.png\\&quot; \\\/&gt;&lt;\\\/td&gt;\\n&lt;td&gt;Use &lt;strong&gt;test&lt;\\\/strong&gt;. When you are ready to accept live payments, change the value to one of our &lt;a href=\\&quot;https:\\\/\\\/adyen.github.io\\\/adyen-ios\\\/5.0.0\\\/documentation\\\/adyen\\\/environment\\\/\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot; class=\\&quot;external-link no-image\\&quot;&gt;live environments&lt;\\\/a&gt;.\\u00a0&lt;\\\/td&gt;\\n&lt;\\\/tr&gt;\\n&lt;\\\/tbody&gt;\\n&lt;\\\/table&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;APIContext initialization&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;swift\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;\\\\\\\/\\\\\\\/ When you are ready to go live, change environment to Environment.live\\\\n\\\\\\\/\\\\\\\/ You can also use other environment values described in https:\\\\\\\/\\\\\\\/adyen.github.io\\\\\\\/adyen-ios\\\\\\\/Docs\\\\\\\/Structs\\\\\\\/Environment.html\\\\nlet apiContext = APIContext(environment: Environment.test, clientKey: clientKey)\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Use &lt;code&gt;apiContext&lt;\\\/code&gt; in your iOS Drop-in or iOS Components configuration instead of &lt;code&gt;publicKey&lt;\\\/code&gt;:&lt;\\\/p&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;iOS Drop-in&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;swift\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;let configuration = DropInComponent.Configuration(apiContext: apiContext)\\\\nlet component = DropInComponent(paymentMethods: paymentMethods, configuration: configuration)\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;iOS Components&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;swift\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;\\\\\\\/\\\\\\\/ Replace CardComponent with the payment method Component that you want to add.\\\\nlet cardComponent = CardComponent(paymentMethod: cardPaymentMethod, apiContext: apiContext)\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:1,&quot;relation&quot;:&quot;&quot;},{&quot;title&quot;:&quot;Android&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;You must be running &lt;a href=\\&quot;\\\/online-payments\\\/build-your-integration\\\/sessions-flow?platform=Android&amp;amp;integration=Drop-in\\&quot;&gt;Android Drop-in&lt;\\\/a&gt; or &lt;a href=\\&quot;\\\/online-payments\\\/build-your-integration\\\/sessions-flow?platform=Android&amp;amp;integration=Components\\&quot;&gt;Android Components&lt;\\\/a&gt; version 3.7.0 or above.&lt;\\\/p&gt;\\n&lt;p&gt;Pass your &lt;code&gt;clientKey&lt;\\\/code&gt; to your Android Drop-in or Android Components configuration object:&lt;\\\/p&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;Android Drop-in&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;kotlin\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;val dropInConfiguration = DropInConfiguration.Builder(context, YourDropInService::class.java, \\\\\\&quot;YOUR_CLIENT_KEY\\\\\\&quot;)\\\\n   \\\\\\\/\\\\\\\/ ...\\\\n   .build()\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&lt;div data-component-wrapper=\\&quot;code-sample\\&quot;&gt;\\n&lt;code-sample :title=\\&quot;&#039;Android Components&#039;\\&quot; :id=\\&quot;&#039;&#039;\\&quot; :code-data=&#039;[{\\&quot;language\\&quot;:\\&quot;kotlin\\&quot;,\\&quot;tabTitle\\&quot;:\\&quot;\\&quot;,\\&quot;content\\&quot;:\\&quot;val cardConfiguration = CardConfiguration.Builder(context, \\\\\\&quot;YOUR_CLIENT_KEY\\\\\\&quot;)\\\\n   \\\\\\\/\\\\\\\/ ...\\\\n   .build()\\&quot;}]&#039; :enable-copy-link-to-code-block=\\&quot;true\\&quot; :code-sample-card-size=\\&quot;&#039;fullsize&#039;\\&quot;&gt;&lt;\\\/code-sample&gt;\\n&lt;\\\/div&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:1,&quot;relation&quot;:&quot;&quot;}]\"\n            :should-update-when-url-changes='false'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<\/li>\n<\/ol>\n<h2 id=\"see-also\">See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/development-resources\/client-side-authentication\"\n                        target=\"_self\"\n                        >\n                    Client-side authentication\n                <\/a><\/li><li><a href=\"\/development-resources\/api-credentials\"\n                        target=\"_self\"\n                        >\n                    How to get the API key\n                <\/a><\/li><li><a href=\"\/online-payments\/drop-in-web\"\n                        target=\"_self\"\n                        >\n                    Web Drop-in\n                <\/a><\/li><li><a href=\"\/online-payments\/components-web\"\n                        target=\"_self\"\n                        >\n                    Web Components\n                <\/a><\/li><li><a href=\"\/online-payments\/build-your-integration\/sessions-flow?platform=iOS&amp;integration=Drop-in\"\n                        target=\"_self\"\n                        >\n                    iOS Drop-in\n                <\/a><\/li><li><a href=\"\/online-payments\/build-your-integration\/sessions-flow?platform=iOS&amp;integration=Components\"\n                        target=\"_self\"\n                        >\n                    iOS Components\n                <\/a><\/li><li><a href=\"\/online-payments\/build-your-integration\/sessions-flow\/?platform=Android&amp;integration=Drop-in\"\n                        target=\"_self\"\n                        >\n                    Android Drop-in\n                <\/a><\/li><li><a href=\"\/online-payments\/build-your-integration\/sessions-flow?platform=Android&amp;integration=Components\"\n                        target=\"_self\"\n                        >\n                    Android Components\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/development-resources\/client-side-authentication\/migrate-from-origin-key-to-client-key","articleFields":{"description":"Learn about how and why to switch to using the client key.","parameters":{"web-version":"3.10.1","ios-version":"3.7.0","android-version":"3.7.0"},"last_edit_on":"29-05-2020 16:11"},"algolia":{"url":"https:\/\/docs.adyen.com\/development-resources\/client-side-authentication\/migrate-from-origin-key-to-client-key","title":"Migrate to client key","content":"If your Web integration uses the origin key or your iOS or Android integration uses the client encryption public key, switch to the client key. In future versions the client key will be the only way to do client-side authentication. The client key makes it easier for you to manage the origins for your integration.\nWith the client key, you have:\n\nA single key for all your allowed origins in an environment.\nFlexibility to add and remove origins without having to generate a new client key.\nA human-readable prefix, test or live, so you can easily tell which environment a client key is linked to.\n\nThe client key also enables card type detection through Bank Identification Number (BIN) lookup, which is not available when using the origin key.\nAvailability and compatibility\nThe client key is available for the following:\n\n\n\nOnline payments integration\nVersion\n\n\n\n\nWeb Drop-in and Components\nAvailable for 3.10.1 and later. Previous versions require origin keys for client-side authentication.  Starting 4.0.0 the client key is the only way to do client-side authentication.\n\n\niOS Drop-in and Components\n3.7.0 and later.  Previous versions require client encryption public keys.  Starting 4.0.0 the client key is the only way to do client-side authentication.\n\n\nAndroid Drop-in and Components\n3.7.0 and later.  Previous versions require client encryption public keys.  Starting 4.0.0 the client key is the only way to do client-side authentication.\n\n\n\n\n\n\nIn-person payments integration\nSolutions\n\n\n\n\nPOS Mobile SDK for iOS\nTap to Pay on iPhone  Card reader&mdash;iOS\n\n\nPOS Mobile SDK for Android\nTap to Pay on Android  Card reader&mdash;Android\n\n\n\nThe client key is backwards compatible with the origin key and the public key. Generating a client key doesn't invalidate a pre-existing origin key or public key.\nSwitch to using the client key\nTo switch to using the client key, you must first generate your client key in your Customer Area:\n\nLog in to your Customer Area.\n\nGo to Developers &gt; API credentials, and select the credential username for your integration, for example ws@Company.[YourCompanyAccount].\nUnder Client settings &gt; Authentication select the Client key tab.\nSelect Generate client key.\nSelect the copy icon  and store your client key securely in your system.\nUnder Add allowed origins, enter your domains and select Add.\nSelect Save changes.\n\n\nOnce you have your client key, you need to add it to your integration. Choose your platform:\n  \n\n    \n        \n        \n    \n\n\n\n\nSee also\n\n\n                    Client-side authentication\n                \n                    How to get the API key\n                \n                    Web Drop-in\n                \n                    Web Components\n                \n                    iOS Drop-in\n                \n                    iOS Components\n                \n                    Android Drop-in\n                \n                    Android Components\n                \n","type":"page","locale":"en","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Development resources","lvl2":"Client-side authentication","lvl3":"Migrate to client key"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/","lvl1":"https:\/\/docs.adyen.com\/development-resources","lvl2":"https:\/\/docs.adyen.com\/development-resources\/client-side-authentication","lvl3":"\/development-resources\/client-side-authentication\/migrate-from-origin-key-to-client-key"},"levels":4,"category":"Development Resources","category_color":"green","tags":["Migrate","client"]}}
