social-feed-api
Advanced tools
Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "social-feed-api", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Aggregates social media feeds and outputs them to use in an API", | ||
@@ -39,3 +39,2 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"instagram": "0.0.4", | ||
"request": "^2.81.0", | ||
@@ -42,0 +41,0 @@ "twitter": "^1.7.0" |
# node-social-feed-api | ||
##### **CURRENTLY IN DEVELOPMENT** | ||
Simple module to fetch all social feeds and output in one simple API call. | ||
@@ -14,4 +12,3 @@ ### Currently supported | ||
##### NOTE: not published yet | ||
`npm install --save social-feed-api` | ||
`npm install --save social-feed-api --production` | ||
@@ -26,8 +23,8 @@ ### Setup | ||
To get an instagram user id go to: https://www.instagram.com/YOUR_USERNAME/?__a=1 | ||
1. In a web browser, navigate to https://www.instagram.com/oauth/authorize/?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code. It will prompt you to login with an instagram account. This is to generate an access token. | ||
2. Once logged in, click the green authorize button. | ||
3. In your console, you should see an object output. One of the fields is called access_token. If you see that, you have successfully generated your access token! | ||
4. Take that access token and place it in your applications env file or equivalent so you do not have to continually generate a new access token (Instagrams access tokens do not expire as of today). | ||
1. First we will need to get the user id of the instagram user you would like to get the feed for. To do this you can go to: https://www.instagram.com/YOUR_USERNAME/?__a=1 | ||
2. In a web browser, navigate to https://www.instagram.com/oauth/authorize/?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code. It will prompt you to login with an instagram account. This is to generate an access token. | ||
3. Once logged in, click the green authorize button. | ||
4. In your console, you should see an object output. One of the fields is called access_token. If you see that, you have successfully generated your access token! | ||
5. Take that access token and place it in your applications env file or equivalent so you do not have to continually generate a new access token (Instagrams access tokens do not expire as of today). | ||
```javascript | ||
@@ -81,2 +78,3 @@ social.initializeInstagram('YOUR_CODE_FROM_CALLBACK_URI') | ||
redirectURI: instagramRedirectURI, | ||
userId: instagramUserId, | ||
}, | ||
@@ -113,2 +111,3 @@ google: { | ||
instagramAccessToken, | ||
instagramUserId, | ||
googleClientId, | ||
@@ -120,2 +119,3 @@ googleClientSecret, | ||
port, | ||
env, | ||
} from './env'; | ||
@@ -144,2 +144,3 @@ | ||
redirectURI: instagramRedirectURI, | ||
userId: instagramUserId, | ||
}, | ||
@@ -171,18 +172,13 @@ google: { | ||
app.get('/v1/instaRedirect', (req, res) => { | ||
if (instaAccessToken) res.status(400).json({ message: 'Access token already generated' }); | ||
if (req.query.code) { | ||
if (!instaAccessToken) { | ||
social.initializeInstagram(req.query.code) | ||
.then(response => { | ||
console.log(response); | ||
instaAccessToken = response.access_token; | ||
res.status(201).json({ message: 'Access token generated successfully!' }); | ||
}, () => { | ||
res.status(400).json({ message: 'Error occurred generating instagram access token.' }); | ||
}); | ||
} | ||
} else { | ||
res.status(400).json({ error: 'An error occurred' }); | ||
} | ||
app.get('/v1/socialFeed', (req, res) => { | ||
const accessTokens = { | ||
instagram: instaAccessToken, | ||
}; | ||
social.getFeeds(accessTokens) | ||
.then(response => { | ||
res.status(200).json({ response }); | ||
}, err => { | ||
console.error(err); | ||
res.status(400).json({ error: 'There was an error fetching feeds' }); | ||
}); | ||
}); | ||
@@ -189,0 +185,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
1
45416
198
- Removedinstagram@0.0.4
- Removedinstagram@0.0.4(transitive)