无法找到 /oauth/device/code Auth0 Java API。

huangapple go评论70阅读模式
英文:

Unable to find /oauth/device/code Auth0 Java API

问题

有没有通过Auth0 Java API获取设备代码的API?我们在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)
英文:

Is there an API to fetch the device code via Auth0 Java API, we use the following snippet in Go, the question is if there is a standard API or should we make a HTTP request call

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)

答案1

得分: 2

文档告诉你需要发送以下形式的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, //以秒为单位
  "interval":5
}

无法找到 /oauth/device/code Auth0 Java API。

英文:

The documentation tells you that you need to send a POST request like the following:

> POST https://YOUR_DOMAIN/oauth/device/code

> Content-Type:

> application/x-www-form-urlencoded
>
> client_id=YOUR_CLIENT_ID&scope=SCOPE&audience=API_IDENTIFIER

and the response would look like

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
}

无法找到 /oauth/device/code Auth0 Java API。

huangapple
  • 本文由 发表于 2022年4月15日 21:10:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/71884469.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定