Tesla API 授权:第 1 步

问题描述 投票:0回答:1

我正在尝试完成 Tesla API 授权的第 1 步(docs):

如果我不包含response_type,我会收到此错误:

{ "error": { "message": "Missing required parameter: response_type", "code": 400, "reason": "AuthorizationError", "referenceID": "929625d426a94badb8b05233ea5e3958-1686939229741" } }

如果我将响应类型包含为“代码”,则会收到此错误:

{ "error": { "message": "Unsupported response type: \"code\"", "code": 501, "reason": "AuthorizationError", "referenceID": "b7aa433afa194531977d6362f3c0e037-1686939263408" } }

我是否错误地使用了 OAuth? API 规范规定,response_type 必须是“代码”,但这表明它不受支持?

Postman Body

我尝试将“code”替换为“token”、“id_token”以及一堆其他组合。不完全确定这里出了什么问题

oauth postman response
1个回答
0
投票

您必须提供表中提供的所有请求参数,即:

client_id
code_challenge
code_challenge_method
redirect_uri
response_type
scope
state
is_in_app

因此,示例工作网址可以是:

https://auth.tesla.com/oauth2/v3/authorize?client_id=ownerapi&code_challenge=3a48088303be990fabca077c7640349f4fbf12ad511096qq514c93eece34d1fe&code_challenge_method=S256&redirect_uri=https%3A %2F%2Fauth.tesla.com%2Fvoid%2Fcallback&response_type=code&scope=openid+email+offline_access+电话&状态=bpn2Csf7M5FTK0m1&is_in_app=true

请注意,在此步骤之后,您将获得重定向网址,从中获取授权代码,我还不知道如何使用 Expo 和 React Native 成功实现。

© www.soinside.com 2019 - 2024. All rights reserved.