Autodesk-forge,2 腿身份验证 (OAuth):oauth
Posted
技术标签:
【中文标题】Autodesk-forge,2 腿身份验证 (OAuth):oauth【英文标题】:autodesk-forge, 2-legged Authentication (OAuth): oauth 【发布时间】:2019-12-27 08:51:13 【问题描述】:不知道我做错了什么,对于 2 腿身份验证。我正在使用 cygwin 终端进行 curl。 回调 URL 是 http://localhost:3000/api/forge/callback/oauth
请查看下面的代码,让我知道出了什么问题。不知道出了什么问题。 jq版本是1.6,curl 7.64.1 GNU bash,版本 4.4.12(3)-release (x86_64-unknown-cygwin)
在我看来,HTTP 版本是错误的原因。我是 forge 的新手。所以给我一些想法,关于这里出了什么问题。
$ curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' -H 'Content-Type: application/x-www-form-urlencoded' -d 'client_id=qWSjFdCYTfhWsLZCSsLcSZCrDY2GsVSq' -d 'client_secret=PChX1GbaPFG42hQi' -d 'grant_type=client_credentials' -d 'scope=data:all'
输出错误报告如下:
* STATE: INIT => CONNECT handle 0x8000770d8; line 1356 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* STATE: CONNECT => WAITRESOLVE handle 0x8000770d8; line 1397 (connection #0)
* Trying 34.212.2.95:443...
* TCP_NODELAY set
* STATE: WAITRESOLVE => WAITCONNECT handle 0x8000770d8; line 1476 (connection #0)
* Connected to developer.api.autodesk.com (34.212.2.95) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x8000770d8; line 1532 (connection #0)
* Marked for [keep alive]: HTTP default
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x8000770d8; line 1547 (connection #0)
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: businessCategory=Private Organization; jurisdictionC=US; jurisdictionST=Delaware; serialNumber=2401504; C=US; ST=California; L=San Rafael; O=Autodesk, Inc.; OU=MCP-ASRD-CP; CN=developer.api.autodesk.com
* start date: Mar 22 00:00:00 2019 GMT
* expire date: Mar 22 12:00:00 2020 GMT
* subjectAltName: host "developer.api.autodesk.com" matched cert's "developer.api.autodesk.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
* SSL certificate verify ok.
* STATE: PROTOCONNECT => DO handle 0x8000770d8; line 1566 (connection #0)
> POST /authentication/v1/authenticate HTTP/1.1
> Host: developer.api.autodesk.com
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 118
>
* upload completely sent off: 118 out of 118 bytes
* STATE: DO => DO_DONE handle 0x8000770d8; line 1621 (connection #0)
* STATE: DO_DONE => PERFORM handle 0x8000770d8; line 1743 (connection #0)
* Mark bundle as not supporting multiuse
* HTTP 1.1 or later with persistent connection
< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Date: Thu, 22 Aug 2019 05:58:08 GMT
< Content-Length: 210
< Connection: keep-alive
<
* STATE: PERFORM => DONE handle 0x8000770d8; line 1933 (connection #0)
* multi_done
* Connection #0 to host developer.api.autodesk.com left intact
"developerMessage":"Requested scopes must be blank or a subset of the provided scopes.","userMessage":"","errorCode":"AUTH-004","more info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-004"
【问题讨论】:
【参考方案1】:正如错误消息所示,data:all
不是有效范围...
请参阅您正在访问的端点的 Resource Information 部分以了解需要哪些范围 - 您可以指定 multiple scopes so long as they are valid 以空格分隔:
scope=data:read data:write bucket:read code:all
【讨论】:
非常感谢!有效。一整天都在挣扎。终于解决了。我不知道我犯了这个错误。以上是关于Autodesk-forge,2 腿身份验证 (OAuth):oauth的主要内容,如果未能解决你的问题,请参考以下文章
似乎无法通过 Gmail API 进行身份验证以阅读电子邮件