-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d952ff
commit 0030814
Showing
4 changed files
with
1,295 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TWITTER_API_KEY="<your twitter app key>" | ||
TWITTER_API_SECRET="<your twitter app secret>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
import {NowRequest, NowResponse} from '@vercel/node'; | ||
import {OAuth, oauth1tokenCallback} from 'oauth'; | ||
|
||
export default (request: NowRequest, response: NowResponse) => { | ||
// var oauth = new OAuth.OAuth( | ||
// 'https://api.twitter.com/oauth/request_token', | ||
// 'https://api.twitter.com/oauth/access_token', | ||
// 'your application consumer key', | ||
// 'your application secret', | ||
// '1.0A', | ||
// null, | ||
// 'HMAC-SHA1' | ||
// ); | ||
// oauth.get( | ||
// 'https://api.twitter.com/1.1/trends/place.json?id=23424977', | ||
// 'your user token for this app', //test user token | ||
// 'your user secret for this app', //test user secret | ||
// function (e, data, res){ | ||
// if (e) console.error(e); | ||
// console.log(require('util').inspect(data)); | ||
// done(); | ||
// }); | ||
// }); | ||
export default async (request: NowRequest, response: NowResponse) => { | ||
var oauth = new OAuth( | ||
'https://api.twitter.com/oauth/request_token', | ||
'https://api.twitter.com/oauth/access_token', | ||
process.env['TWITTER_API_KEY'], | ||
process.env['TWITTER_API_SECRET'], | ||
'1.0A', | ||
null, | ||
'HMAC-SHA1' | ||
); | ||
|
||
const {name = 'World'} = request.query; | ||
response.status(200).json(process.env); | ||
const test = await new Promise<Parameters<oauth1tokenCallback>>(resolve => | ||
oauth.getOAuthRequestToken((...data) => resolve(data)) | ||
); | ||
|
||
response.status(200).json(test); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
0030814
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: