このコンテンツは選択した言語では利用できません。

Chapter 2. General API Information


2.1. Authentication

The OpenShift API supports multiple authentication mechanisms, including Basic Authentication and authorization tokens.
Basic Authentication

With Basic Authentication a client is required to send the user name and password, separated by a colon, with all requests to correctly authenticate. This string is encoded with Base64 algorithm and transmitted in the HTTP authorization header in the following formats.

Ruby
require 'base64'
base64string = Base64.encode64("#{username}:#{password}").strip
headers = { "Authorization" => "Basic #{base64string}" }
Copy to Clipboard Toggle word wrap
Python
import base64
base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
request.add_header("Authorization", "Basic %s" % base64string)
Copy to Clipboard Toggle word wrap
cURL
The cURL library supports basic authentication using the --user option, as shown in the following example.
$ curl https://openshift.redhat.com/broker/rest/user --user user@example.com
Copy to Clipboard Toggle word wrap
Authorization Tokens

You can also use authorization tokens to authenticate with the remote server instead of your user name and password. However, before you can use an authorization token you must first create one with the appropriate scope option. See Chapter 6, Authorizations for more information on creating and managing authorization tokens.

When you have an authorization token, you can substitute it in place of your login credentials, as shown in the following format:
$ curl https://openshift.redhat.com/broker/rest/user -H "Authorization: Bearer token_id"curl https://openshift.redhat.com/broker/rest/user -H "Authorization: Bearer token_id"curl https://openshift.redhat.com/broker/rest/user -H "Authorization: Bearer token_id"
Copy to Clipboard Toggle word wrap

Example 2.1. cURL Command with Authorization Token

The following example shows a REST call to delete an application using an authorization token for authentication instead of a user name and password.
curl -X DELETE https://openshift.redhat.com/broker/rest/application/5406971c5973ca2a7f0000c6 -H "Authorization: Bearer 14fc97947174a911c3d1154aa846197cbc18ad550d7ad1cdd58aab105e65783a"
Copy to Clipboard Toggle word wrap
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat