I've made a call to https://login.windows.net/common/oauth2/token
and received something like this in response:
{
"token_type": "Bearer",
"scope": "Directory.Read.All User.Read",
"expires_in": "3600",
"ext_expires_in": "0",
"resource": "https://graph.windows.net",
"access_token": {{really_long_token_1}},
"refresh_token": {{really_long_token_2}},
"id_token": {{really_long_token_3}}
}
I have a website hosted on HostGator that's trying to access an API I have located on Azure.
What is the correct form of a GET
call to my API hosted on Azure? Here's what I have so far:
$url = 'https://myappservice.azurewebsites.net/api/getValues';
$options = array(
'http' => array(
'header' => array(
'x-ms-version: 2017-06-02',
'Authorization: Bearer {{really_long_token_1}}'
),
'method' => 'GET'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$var_dump($result);
I end up getting 500
Server Errors while making this call.
The 500
is Internal Error which indicates the server encountered an unexpected condition which prevented it from fulfilling the request.
It should not be relative to the authentication/authorization, please check whether there is code can cause this exception. Or you can just replace the code with a very easy code sample without any complex business logic just return the values.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.