Python3を使用してManheim社を通じてAPIのOAuth2認証を使用しようとしています。
ドキュメントには、「「クライアント資格情報」と「リソース所有者」の付与タイプの両方が現在サポートされており、トークンを要求するために必要な変更について詳しく説明しています」と記載されています。APIのドキュメントは次のとおりです:http://developer.manheim.com/#/authentication
次のリンクをガイドとして使用しましたが、役に立ちませんでした:https://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow
彼らは私にクライアントIDとクライアントシークレットを提供してくれました。次のエラーが表示されます。
MissingTokenError: (missing_token) Missing access token parameter.
私はこれを試しました:
from oauthlib.oauth2 import BackendApplicationClient
client_id = 'my_id'
client_secret = 'my_secret'
token_url = 'https://sandbox.api.manheim.com/oauth2/token.oauth2'
client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)
token = oauth.fetch_token(token_url=token_url,
client_id=client_id,client_secret=client_secret)
私もこれを試しました:
from oauthlib.oauth2 import BackendApplicationClient
from requests.auth import HTTPBasicAuth
client_id = 'my_id'
client_secret = 'my_secret'
token_url = 'https://sandbox.api.manheim.com/oauth2/token.oauth2'
auth = HTTPBasicAuth(client_id, client_secret)
client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)
token = oauth.fetch_token(token_url=token_url, auth=auth)
私は他のテクニックを試しましたが、成功しませんでした。私は何が間違っているのですか?APIにアクセスするには何が必要ですか?
私はすべての助けに感謝します!
結果:APIを管理している開発者チームに連絡して自分で修正しました。間違ったエンドポイントを使用していました。
token_urlを次のように変更しました。
token_url = 'https://api.manheim.com/oauth2/token.oauth2'
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加