Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 2. Creating the API token in automation hub

download PDF

Before you can interact with automation hub by uploading or downloading collections, you must create an API token. The automation hub API token authenticates your ansible-galaxy client to the Red Hat automation hub server.

Your method for creating the API token differs according to the type of automation hub that you are using:

2.1. Creating the API token in automation hub

In automation hub, you can create an API token by using Token management. The API token is a secret token used to protect your content.

Procedure

  1. Navigate to Ansible Automation Platform on the Red Hat Hybrid Cloud Console.
  2. From the navigation panel, select Automation Hub Connect to Hub.
  3. Under Offline token, click Load Token.
  4. Click the Copy to clipboard icon to copy the API token.
  5. Paste the API token into a file and store in a secure location.
Important

The API token is a secret token used to protect your content. Store your API token in a secure location.

The API token is now available for configuring automation hub as your default collections server or for uploading collections by using the ansible-galaxy command line tool.

Note

The API token does not expire.

2.2. Creating the API token in private automation hub

In private automation hub, you can create an API token using API token management. The API token is a secret token used to protect your content.

Prerequisites

  • Valid subscription credentials for Red Hat Ansible Automation Platform.

Procedure

  1. Log in to your private automation hub.
  2. From the navigation panel, select Collections API token.
  3. Click Load Token.
  4. To copy the API token, click the Copy to clipboard icon.
  5. Paste the API token into a file and store in a secure location.
Important

The API token is a secret token used to protect your content. Store your API token in a secure location.

The API token is now available for configuring automation hub as your default collections server or uploading collections using the ansible-galaxy command line tool.

Note

The API token does not expire.

2.3. Keeping your offline token active

Offline tokens expire after 30 days of inactivity. You can keep your offline token from expiring by periodically refreshing your offline token.

Keeping an online token active is useful when an application performs an action on behalf of the user; for example, this allows the application to perform a routine data backup when the user is offline.

Note

If your offline token expires, you must request a new one.

Procedure

  • Run the following command to prevent your token from expiring:

    curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id="cloud-services" -d refresh_token="{{ user_token }}" --fail --silent --show-error --output /dev/null
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.