问题
I am trying to access rest api which needed a Oauth 1.0a authentication. Currently I have api key, access token. How to set Authorization with access token to access api in following code snippet.
- How syntax looks like for Authorization with access token
- what are necessary attributes needs to be set
- Is there any region issues can exist for api access?
- when it shows No 'Access-Control-Allow-Origin' header is present on the requested resource. Error
I am trying to set http header in following code snippet,
$resource('url', {}, {
"getData": {
method: "GET",
headers: {
'Content-Type': 'application/json',
//?
}
}
});
Thank you.
回答1:
Let's say that your access token is called Token. Your header should looks like this:
headers: {
'Authorization': 'Token QWxhZGRpbjpvcGVuIHNlc2Ff(Key example)'}
}
来源:https://stackoverflow.com/questions/28912506/how-to-set-auth-token-in-http-header-in-angular-js-resource-get