无法找到 /oauth/device/code Auth0 Java API
Unable to find /oauth/device/code Auth0 Java API
是否有API通过Auth0获取设备代码JavaAPI,我们在Go中使用以下代码片段,问题是是否有标准API 或者我们应该调用 HTTP 请求
url := "https://dev-foo.us.auth0.com/oauth/device/code"
payload := strings.NewReader("client_id=RO6N7mr&scope=openid&audience=https://dev-foo.us.auth0.com/api/v2/")
req, _ := http.NewRequest("POST", url, payload)
documentation 告诉您需要发送一个 POST 请求,如下所示:
POST https://YOUR_DOMAIN/oauth/device/code
Content-Type:
application/x-www-form-urlencoded
client_id=YOUR_CLIENT_ID&scope=SCOPE&audience=API_IDENTIFIER
响应看起来像
HTTP/1.1 200 OK
Content-Type: application/json
{
"device_code":"GmRh...k9eS",
"user_code":"WDJB-MJHT",
"verification_uri":"https://YOUR_DOMAIN/device",
"verification_uri_complete":"https://YOUR_DOMAIN/device?user_code=WDJB-MJHT",
"expires_in":900, //in seconds
"interval":5
}
是否有API通过Auth0获取设备代码JavaAPI,我们在Go中使用以下代码片段,问题是是否有标准API 或者我们应该调用 HTTP 请求
url := "https://dev-foo.us.auth0.com/oauth/device/code"
payload := strings.NewReader("client_id=RO6N7mr&scope=openid&audience=https://dev-foo.us.auth0.com/api/v2/")
req, _ := http.NewRequest("POST", url, payload)
documentation 告诉您需要发送一个 POST 请求,如下所示:
POST https://YOUR_DOMAIN/oauth/device/code
Content-Type:
application/x-www-form-urlencoded
client_id=YOUR_CLIENT_ID&scope=SCOPE&audience=API_IDENTIFIER
响应看起来像
HTTP/1.1 200 OK
Content-Type: application/json
{
"device_code":"GmRh...k9eS",
"user_code":"WDJB-MJHT",
"verification_uri":"https://YOUR_DOMAIN/device",
"verification_uri_complete":"https://YOUR_DOMAIN/device?user_code=WDJB-MJHT",
"expires_in":900, //in seconds
"interval":5
}