Skip to content

Commit 3638b0e

Browse files
authored
Fix Twitter API Oauth Error (#7370)
1 parent 181fbf9 commit 3638b0e

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

spec/OAuth1.spec.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,33 @@ describe('OAuth', function () {
8787
done();
8888
}
8989

90-
it('Should fail a GET request', done => {
90+
it('GET request for a resource that requires OAuth should fail with invalid credentials', done => {
91+
/*
92+
This endpoint has been chosen to make a request to an endpoint that requires OAuth which fails due to missing authentication.
93+
Any other endpoint from the Twitter API that requires OAuth can be used instead in case the currently used endpoint deprecates.
94+
*/
9195
const options = {
9296
host: 'api.twitter.com',
93-
consumer_key: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
94-
consumer_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
97+
consumer_key: 'invalid_consumer_key',
98+
consumer_secret: 'invalid_consumer_secret',
9599
};
96-
const path = '/1.1/help/configuration.json';
100+
const path = '/1.1/account/settings.json';
97101
const params = { lang: 'en' };
98102
const oauthClient = new OAuth(options);
99103
oauthClient.get(path, params).then(function (data) {
100104
validateCannotAuthenticateError(data, done);
101105
});
102106
});
103107

104-
it('Should fail a POST request', done => {
108+
it('POST request for a resource that requires OAuth should fail with invalid credentials', done => {
109+
/*
110+
This endpoint has been chosen to make a request to an endpoint that requires OAuth which fails due to missing authentication.
111+
Any other endpoint from the Twitter API that requires OAuth can be used instead in case the currently used endpoint deprecates.
112+
*/
105113
const options = {
106114
host: 'api.twitter.com',
107-
consumer_key: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
108-
consumer_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
115+
consumer_key: 'invalid_consumer_key',
116+
consumer_secret: 'invalid_consumer_secret',
109117
};
110118
const body = {
111119
lang: 'en',

0 commit comments

Comments
 (0)