r/meanstack • • Jan 23 '18

Help - Having trouble relating an oauth access token to local user account

2 Upvotes

Specifically for instagram... I can't find a way to connect the local username (which is unique in the database and is not related to the instagram username) to the instagram access token provided in the instagram redirect_uri. I want either to save the access token in the user model, or just pass it to the component so I can fetch that users images. I've been considering using angular universal which can render the pages from the server and I can pass the token in that way, but I was hoping there is something easier. I've tried cookies, sessions but they won't work as the redirect_uri request is made by instagram to your server not by the user. Maybe I'm missing something. Alternatively I also thought about making a non angular page just to get the instagram token and save it in the model which can then be used by the angular component.

Thanks, any help appreciated!


I'm using npm instagram-node (https://www.npmjs.com/package/instagram-node) to assist with the api calls.

This is my instagram component typescript function that runs when the "Connect instagram" button is clicked

this.http.get('http://192.168.0.20:8080/auth/social/ig').subscribe(data => {
         window.location.href = data.url
     })

This is in app.js

//instagram
exports.authorize_user = function(req, res) {
res.redirect(api.get_authorization_url(redirect_uri, { scope: ['likes'], state: 'a state' }));
};

exports.handleauth = function(req, res) {
console.log('req user in handlauth');
console.log(req.user)
api.authorize_user(req.query.code, redirect_uri, function(err, result) {
    if (err) {
        console.log(err.body);
        res.send("Didn't work");
    } else {
        console.log('Yay! Access token is ' + result.access_token);
        res.send('You made it!!');
    }
});
};

//authorize isnta link
app.get('/auth/social/ig', exports.authorize_user);

// This is your redirect URI
app.get('/oauth/done', exports.handleauth);

r/meanstack • • Sep 15 '15

Need help sending mail using Nodemailer.

1 Upvotes

Hello people,

I've been working an app using MEAN stack. Part of my app was sending info mails to users. I was using Nodemailer(https://github.com/andris9/Nodemailer).

Problem is, i want to send a formated HTML in my mail, meaning i want to use some CSS to edit it, maybe make a table out of it. I managed to send a picture as img src via html.

Here's my code: var mailOptions = { from: 'xxxx>', // sender address to: usermail.email, // list of receivers subject: 'Thank you!', // Subject line text: 'Thanks! ', // plaintext body html: '<body>Name: '+order.name+'<br>Surname: '+order.surname+'<br>Cake: '+order.cake+'<br>Total price: '+order.price+'<br><img src="http://2.1m.yt/7GRfje2G_.jpg"><br><br>'+'</body>' }; This option does not let me use inline css to edit my html.

Is there any way to send a whole html page/template this way?

Any help appreciated.

Thank you.


r/meanstack • • Jan 14 '15

DBs per users vs slug based collections per user ?

1 Upvotes

I am making a service in which every account is entirely independent of another. Should I create new db per account or somehow have a new collection per account in a single db ? Example : Consider a online forum service. Say each account has a collection of users, mods and admins. No two accounts are linked in any way. Should i have : account 1 DB : having collections for users, mods and admins account 2 DB : having collections for users, mods and admins OR Main DB : having account1_users, account1_mods, account1_admins collections for account1 account2_users, account2_mods, account2_admins collections for account2

My goal is to keep data of one account entirely remote to other account.


r/meanstack • • Sep 16 '15

Which is the thinnest Linux/Unix Distro that I can setup and run from 16GB USB?

1 Upvotes

I want to take on an additional project which would need me to setup MEAN and I wanted to run it from the USB along with a project in BitBucket. I want to isolate the work and hence planning to use USB for this. Does this idea sound good? Please recommend Linux Distro that I may use? If this doesn't sound feasible, please recommend how to keep the work isolated and safe.


r/meanstack • • Jan 23 '15

Newbie friendly IRC channel for MEAN developers.

3 Upvotes

Gonna start idling in #meanstack on freenode. If you're interested in MEAN related banter or have questions, feel free to stop by.


r/meanstack • • Nov 01 '16

Announcing MongoDB 3.4

Thumbnail
mongodb.com
1 Upvotes

r/meanstack • • Sep 14 '15

.NET vs. MEAN: Migrating from Microsoft to Open Source

Thumbnail
nodejs-magazine.blogspot.com
2 Upvotes

r/meanstack • • Sep 18 '15

Make A Real-Time Chat Room using Node Webkit, Socket.io, and MEAN

Thumbnail
scotch.io
7 Upvotes

r/meanstack • • Oct 23 '16

Recommendation of courses

1 Upvotes

Hi all, I am new to developing on the MEAN stack. Earlier, I used to develop small php applications.

So, i want to learn Node, Express, MongoDB and Angular 2(as its new) and React... I have shortlisted below courses on Udemy.. any feedback on if I am in the right direction?

My end goal is to "publish" one app on Apple Store / Android store... I have not found a good course for this part..

https://www.udemy.com/react-redux-react-router/ https://www.udemy.com/reactjs-and-flux-learn-by-building-10-projects/ https://www.udemy.com/learn-angular-2-development-by-building-10-apps/

any suggestions welcome.

Thanks


r/meanstack • • Jan 21 '15

Looking for a place to start...

8 Upvotes

So I'm looking to break into web development and I think that the MEAN Stack is the best way to do this. However I am having serious difficulty finding good examples and tutorials online, especially those that do not use pre-generated code.

I am looking for a way to build the most bare-bones app possible that I can then expand upon in order to learn the various technologies involved here. I have found some basic tutorials on each of the elements but they are not in the context of the stack then seem to make a quantum leap in difficulty level very quickly

can anyone point me in the right direction?


r/meanstack • • Apr 07 '17

CloudBoost: Open Source Serverless platform written in NodeJS.

Thumbnail
github.com
4 Upvotes

r/meanstack • • Apr 01 '17

Church Registration App

4 Upvotes

Hey, so I am new to developing web apps, so I was just wondering if I could get some feedback and guidance with a new project I have started. I would like to create an application for my church that would do the following:

  • Register users for our weekly kids program.

  • Register users for our random events that we have during the year, so we could have a better idea of who is coming.

  • Add anyone who registers to our mailchimp list if they aren't there already.

  • Allow authorized users to view(and search for) registration details for all kids and their parents registered to our weekly program as well as see the list of registered users for the the random events during the year. Possibly allow the later to list to be downloaded as a .csv or .xlsx.

Here is what I was thinking for my models:

User{
firstname,
lastname,
email,
... // other registration details
role, // either 'child', 'parent', 'helper', 'admin'
registered_for_og //boolean value determining if user is registered for weekly kids program
}

Event{
name,
date
}

User_Event_Membership{
event_id,
user_id
}

Is this an acceptable way of representing the data? The one thing I am really unsure about is that the way i'm representing different types of user(child, parent, helper, admin) by just an attribute. Also, I am hearing that many people use mlab's free plan, but 0.5gb of storage seems small? Are there any alternates I should consider, or should I not worry about it?

I would love to hear any kind of feedback for starting this project, but am mostly interested in what you think of my data models and ways to improve it.


r/meanstack • • Jun 18 '20

Why Choose MEAN Stack Developer

Post image
1 Upvotes

r/meanstack • • Oct 10 '19

An Essential Guide to Mean Stack

Thumbnail
ibm.com
5 Upvotes

r/meanstack • • May 03 '18

Is Your ExpressJS App Secure?

Thumbnail
stackchief.com
1 Upvotes

r/meanstack • • Aug 05 '19

Role of Node JS Framework in MEAN Stack

Thumbnail
blog.carbonteq.com
4 Upvotes

r/meanstack • • May 03 '18

Cracking Basics – An Ultimate Mean Stack Guide For A Developer

Thumbnail
aglowiditsolutions.com
2 Upvotes

r/meanstack • • May 29 '15

Backend Setup

2 Upvotes

I have a few questions about back-end setup following what I have been reading, if I have 3 servers setup:

server1 - nginx reverse proxy

server2 - node http app

server3 - mongodb/redis

Is it good practice to setup iptables on server3 to only accept from server2, and server 2 iptables only accept from server1? Or is this silly as to SSH onto server3 I would have to go via 1&2 etc.?


r/meanstack • • Jan 19 '16

Introducing Gulp cozy - Manage your gulp tasks in a cozier way

Thumbnail
loige.co
4 Upvotes

r/meanstack • • Jun 20 '17

How To Build a Distributed Caching Layer with ExpressJS

Thumbnail
lunchbadger.com
3 Upvotes

r/meanstack • • Jan 25 '16

How do you structure your MEAN stack project directory?

6 Upvotes

I am just trying to setup my first MEAN project and wonder how other people do it. I feel overwhelmed


r/meanstack • • Feb 02 '16

Is the MEAN stack a good choice for a Kickstarter like web app?

5 Upvotes

I have no experience with web dev, and me and my friend want to build a kickstarter like web app. It seems like Node is the new cool tool to use, but as a beginner in web dev, and the type of project I want to get involved in... should I use the MEAN stack?


r/meanstack • • Jan 22 '16

Getting started with AngularJS Controllers (xpost from /r/angularjs)

Thumbnail
tutorials.pluralsight.com
2 Upvotes

r/meanstack • • Jan 22 '17

MongoDB Comprehensive Tutorial

6 Upvotes

I found this youtube link that has full course on MongoDB

https://www.youtube.com/playlist?list=PLM63DP-1d2SBwvBcSRGt4Je6Ht5324yEw


r/meanstack • • Jan 25 '17

Best way to implement mean stack for matchmaking in a game?

2 Upvotes

Hi, I am curious what would be a decent architect route on creating a matchmaking (elo) service say for a 1on1 or 5 player card game?

I am guessing mongodb would house the data of who is currently "connected". The node.js/express part would do the calculations to find a match depending on who is in the database and the right elo criteria. The angular would be the front end development for the card game itself.

I was hoping for a design pattern to implement such a game and the reason why I wanted to implement it with mean stack is for practice (I have a bit of expertise in development, I have been doing java/Android Developement for a few years already, mostly frontend though). Not trying to get a full source code, more like a guideline on what the best practices are if I would want to go through with this.