Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 向onedrive发出请求的正确方式_Azure_Microsoft Graph Api - Fatal编程技术网

Azure 向onedrive发出请求的正确方式

Azure 向onedrive发出请求的正确方式,azure,microsoft-graph-api,Azure,Microsoft Graph Api,我正试图向OneDrive提出请求,但到目前为止没有成功。我已经能够获得我认为很好的访问令牌,因为我可以从https://graph.microsoft.com/v1.0/me。但是当我尝试访问https://graph.microsoft.com/v1.0/me/drive我得到500个错误响应,响应对象是这样说的: [message:protected] => Unable to resolve template token [string:Exception:private] =&g

我正试图向OneDrive提出请求,但到目前为止没有成功。我已经能够获得我认为很好的访问令牌,因为我可以从
https://graph.microsoft.com/v1.0/me
。但是当我尝试访问
https://graph.microsoft.com/v1.0/me/drive
我得到500个错误响应,响应对象是这样说的:

[message:protected] => Unable to resolve template token
[string:Exception:private] => 
[code:protected] => 500
[file:protected] => C:\xampp\htdocs\OneDrive\vendor\thenetworg\oauth2-azure\src\Provider\Azure.php
[line:protected] => 68
[trace:Exception:private] => Array
    (
        [0] => Array
            (
                [file] => C:\xampp\htdocs\OneDrive\vendor\league\oauth2-client\src\Provider\AbstractProvider.php
                [line] => 644
                [function] => checkResponse
                [class] => TheNetworg\OAuth2\Client\Provider\Azure
                [type] => ->
                [args] => Array
                    (
                        [0] => GuzzleHttp\Psr7\Response Object
                            (
                                [reasonPhrase:GuzzleHttp\Psr7\Response:private] => Internal Server Error
                                [statusCode:GuzzleHttp\Psr7\Response:private] => 500
                                [headers:GuzzleHttp\Psr7\Response:private] => Array
                                    (
                                        [Cache-Control] => Array
                                            (
                                                [0] => private
                                            )

                                        [Transfer-Encoding] => Array
                                            (
                                                [0] => chunked
                                            )

                                        [Content-Type] => Array
                                            (
                                                [0] => application/json
                                            )

                                        [request-id] => Array
                                            (
                                                [0] => 7fc5c1c8-bd33-4788-bae9-5887d261c8c5
                                            )

                                        [client-request-id] => Array
                                            (
                                                [0] => 7fc5c1c8-bd33-4788-bae9-5887d261c8c5
                                            )

                                        [x-ms-ags-diagnostic] => Array
                                            (
                                                [0] => {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceB","ScaleUnit":"003","Host":"AGSFE_IN_2","ADSiteName":"AMS"}}
                                            )

                                        [Duration] => Array
                                            (
                                                [0] => 177.0851
                                            )

                                        [Date] => Array
                                            (
                                                [0] => Mon, 06 Feb 2017 12:55:27 GMT
                                            )

                                    )

                                [headerNames:GuzzleHttp\Psr7\Response:private] => Array
                                    (
                                        [cache-control] => Cache-Control
                                        [transfer-encoding] => Transfer-Encoding
                                        [content-type] => Content-Type
                                        [request-id] => request-id
                                        [client-request-id] => client-request-id
                                        [x-ms-ags-diagnostic] => x-ms-ags-diagnostic
                                        [duration] => Duration
                                        [date] => Date
                                    )

                                [protocol:GuzzleHttp\Psr7\Response:private] => 1.1
                                [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
                                    (
                                        [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #79
                                        [size:GuzzleHttp\Psr7\Stream:private] => 237
                                        [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                                        [readable:GuzzleHttp\Psr7\Stream:private] => 1
                                        [writable:GuzzleHttp\Psr7\Stream:private] => 1
                                        [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                                        [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                                            (
                                            )

                                    )

                            )

                        [1] => Array
                            (
                                [error] => Array
                                    (
                                        [code] => InternalServerError
                                        [message] => Unable to resolve template token
                                        [innerError] => Array
                                            (
                                                [request-id] => 7fc5c1c8-bd33-4788-bae9-5887d261c8c5
                                                [date] => 2017-02-06T12:55:28
                                            )

                                    )

                            )

                    )

            )

问题是我使用的是官方文件推荐的软件包。指向令牌和授权URL的链接未指向v2.0端点。

如果您使用此帐户登录,调用
/me/drive/
是否会导致相同的错误?好的,看来问题在于我没有在我的授权和令牌URL中使用
v2.0
。现在一切都正常了。你能把这篇文章作为回应,并把你的答案标记为正确吗?