Hizmet hesapları, uygulamalar tarafından Google API'lerine OAuth 2.0 aracılığıyla programatik olarak erişmek için kullanılabilecek özel Google hesaplarıdır. Bir hizmet hesabı, ek yetkilendirme gerektirmeyen bir OAuth 2.0 akışı kullanıyor. Bunun yerine, yalnızca uygulamanızın erişebileceği bir anahtar dosyası kullanır. Bu kılavuzda, Manufacturer Center API'ye hizmet hesaplarıyla nasıl erişileceği açıklanmaktadır.
Ön koşullar
- Bir Manufacturer Center hesabı.
Manufacturer Center API'ye erişmek için hizmet hesabı kullanma adımları
Hizmet hesabı kimlik bilgileri oluşturun veya daha önce oluşturduğunuz herkese açık kimlik bilgilerine erişin. Bir OAuth 2.0 İstemci Kimliği oluşturmanız ve *.json özel anahtar dosyası almanız gerekir:
Google API Konsolu'na gidin.
Sayfanın üst kısmındaki açılır menüden bir proje seçin. Henüz bir projeniz yoksa Create a Project'i (Proje Oluştur) tıklayarak oluşturun.
Bu proje için Manufacturer Center API'yi henüz etkinleştirmediyseniz Google API'leri listesinde arayın ve etkinleştirin.
Soldaki kenar çubuğunda Credentials (Kimlik bilgisi) seçeneğini belirleyin.
Hizmet hesabı oluşturmak için Kimlik bilgisi oluştur'u ve ardından Hizmet hesabı anahtarı'nı seçin. ![Hizmet hesabı kimlik bilgileri oluşturun
ekran görüntüsü.](../images/create_service_account_credentials.png)
6. On the next page, select **New service account** from the drop-down
list.
7. <a name="service-account-name"></a> Name the new service account. This
also serves as the default username for the service account ID. Remember
the service account ID for use later.
Note: The choice of role for the service account will not have any effect on
what calls can be made to the Manufacturer Center API, as access to
Manufacturer Center API methods is determined instead by the role
associated with the service account ID in Manufacturer Center. If you
are unsure what to pick, just pick Project►Viewer.
![New service account name
ekran görüntüsü.](../images/new_service_account_name.png)
8. Select **JSON** for the key type, then click **Create**.
9. The **Create** button will change to **Creating...**, and once the key
generation finishes, it will automatically download the private key as a
*.json file.
Important: Protect the *.json key file that allows a service account to
access the Google services for which it has been authorized. It is good
practice to allow service accounts to only access one Google API each. This
is a preventative measure to mitigate the amount of data an attacker can
access in the situation that the service account's *.json key file is
compromised.
10. You will be returned to the Credentials page, and you should see the
new service account in the list of service account keys for your
account.
Yeni hizmet hesabını Manufacturer Center hesabınıza kullanıcı olarak ekleyin. Üçüncü taraf geliştiriciyseniz müşterinizin bu adımı sizin adınıza gerçekleştirmesini sağlamanız gerekir.
Manufacturer Center hesabınızın ayarlarında "Kullanıcılar" listesine gidin.
+Kullanıcı düğmesini tıklayın ve hizmet hesabı kimliğini yeni kullanıcının e-posta adresi olarak kullanın. ![Hizmet hesabı kullanıcısı ekle düğmesi
ekran görüntüsü.](../images/add_service_account_network_settings.png)
4. Fill in the form with the [service account ID](#service-account-name),
and select the desired user role(s). At least one must be chosen, and
use of the `Accounts` service requires the Admin role.
If you did not take note of the service account ID earlier, go to the
[Service
Accounts](https://console.developers.google.com/iam-admin/serviceaccounts/)
administration page and select the project you created.
![Add service account user page
ekran görüntüsü.](../images/add_service_account_page.png)
5. Click on the **Save** button. You will be returned to the list of users,
and the service account ID should be listed with the chosen user role(s).
6. Repeat the process for all other service accounts you want to add.
7. View existing service account users by going to the Users tab. These
will be users with an email address ending in 'gserviceaccount.com'.
- Artık Google Uygulaması Varsayılan Kimlik Bilgileri akışını veya hizmet hesabı akışını kullanarak hizmet hesabını kullanarak Manufacturer Center hesabınıza erişebilirsiniz. Manufacturer Center API Örnekleri, desteklenen her programlama dilinde hizmet hesabı kimlik bilgileri için her iki akışın nasıl kullanılacağını gösterir. Yeni hizmet hesabınızı denemek ve hizmet hesaplarını kendi kodunuzda kullanmak için yapmanız gereken değişiklikleri öğrenmek üzere kod örneklerini inceleyin.
Sık sorulan sorular
Hizmet hesabımla Manufacturer Center web kullanıcı arayüzüne giriş yapabilir miyim?
Hayır, hizmet hesapları normal Google hesapları değildir ve Manufacturer Center web kullanıcı arayüzüne erişemezler.
Hizmet hesabı erişim jetonlarını ne sıklıkta yenilemem gerekir?
Erişim jetonlarının geçerlilik süresi, Google OAuth 2.0 Yetkilendirme Sunucusu tarafından verildikten bir saat sonra dolar. Erişim jetonunun süresi dolduğunda uygulama başka bir erişim jetonu almak için istemci kitaplığını kullanmalıdır.