Node.js App From Scratch | Express, MongoDB & Google OAuth

Traversy Media · 659K views · 2020 · 2:28:43

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a worked example of Passport Google OAuth in Express, and they cite its timestamps when asking about errors in specific steps of the build.

Recommended by 5 people across 5 different months, 2020 to 2022.

What it is

A 2.5 hour project-based tutorial by Brad Traversy that builds a full 'StoryBooks' app with Node.js, Express, MongoDB/Mongoose, Handlebars templates and Passport with Google OAuth. It walks from database setup through sessions, CRUD for stories, and method override, with timestamped chapters and full code on GitHub.

What people said

Recommends Stefan Dobre · 2020-09 · Stack Overflow · on “How to manage OAuth in Node-Express / Vue web app?”

:) Hello, For an one page web app you should use Authorization Code Flow [LINK] and with Passport after an oauth attempt you should have a middleware that will redirect you in case of failure or success : Passport Documentation [LINK] : [LINK] And a good exemple for me was this Traversy Media - backend app with oAuth [this video] I don't think that passport is the problem, the flow of the token is in your case...

Recommends Rafael Dias · 2020-11 · Stack Overflow · on “MVC, passport.js and verifying if user is authenticad and then redirect?”

How are you all? This time I got stuck hard. I'm studying MVC and trying to implement an auth with passport.js. Everything went perfectly until realize that everyone, authenticated or not, can access my routes if they know the url. Searching a bit, I found a tutorial in Youtube that solve my problem, but It doesn't use MVC and I've tried on my own, but got a strange problem: When I try to access /dashboard , even logged, I got redirected to / . Can you guys give me a light to what I'm doing wrong? The tutorial is : [this video] Thanks in advance! my routes>login.js const express = require('express'); const router = express.Router(); const loginController = require('../controllers/login'); const i

Recommends MaX · 2021-04 · Stack Overflow · on “Error: File validation failed: content: Path `content` is required., title: Path `title` is required”

I'm trying trying to add text data in the database and display it on the dashboard. I have created a separate route for adding files. I'm following Brad's video: NodejsfromScratch [this video] I'm currently stuck at Add files part (1:31:24) When I enter the text data in the add files form, I get this error: Error: File validation failed: content: Path `content` is required., title: Path `title` is required. at ValidationError.inspect (E:\EXP_NP\BT\node_modules\mongoose\lib\error\validation.js:47:26) at internal/per_context/primordials.js:23:32 at formatValue (internal/util/inspect.js:783:19) at inspect (internal/util/inspect.js:337:10) at formatWithOptionsInternal (internal/util/inspect.js:2016:4

Recommends SwimBikeRun · 2021-05 · Stack Overflow · on “Deployment of a socket.io app, how to avoid accidentally breaking prod by shipping to localhost instead of hosted backend?”

I found a pretty great solution following along with [this video] Set up prod/dev/etc. scripts in the package.json and then use that logic in the code via `process.env.NODE_ENV`

Recommends CS_DR · 2022-08 · Stack Overflow · on “Passport.js OAuth2 TokenError -> OAuth2Strategy.parseErrorResponse”

Hello to whoever is willing to read this. After having browsed through every somewhat related question on StackOverflow (and other sites) to try and get a grasp of the cause of my problem, I have decided to ask a question here myself. First of all, I was trying to follow along a tutorial [this video] (came up to around the 1h mark, YouTube timestamp/chapter details provide a good overview on what that covers, but I can summarize if needed) on how to implement an OAuth2 login/workflow in a Node.js Express app. The main difference here is that I wanted to use a different Passport / OAuth2 strategy, for which passport-oauth2 [LINK] seemed to be a good solution. Anyway, the App works fine until it co

Cites JordanAF808 · 2020-08 · Stack Overflow · on “Only one Handlebar Helper works at a time. Either stripTags or truncate, not both?”

I'm trying to use two Handlebar Helpers on the {{body}} but only one of them is working? I'm following Traversy media's Node.js App from Scratch youtube course here [this video] at 1:44:10. I triple checked my code against his using diffchecker. Here are the two helpers I'm using on the template index.hbs: <p>{{stripTags (truncate body 150)}}</p> But, once I add "150" to truncate, the helper 'stripTags' stops working and shows the html but does truncate it to 150 characters. from this: J Story 2 I'm baby marfa coloring book church-key, vape leggings 8-bit hashtag umami tbh mixtape chillwave. Butcher cliche unicorn, yr VHS bicycle rights try-hard drinking vinegar. Woke vaporware art party subway t

Cites Souhail Mohamed · 2021-03 · Stack Overflow · on “mongo-connect error with mongo-connect(session)”

After searching around about it, I can't find any solution or mistake in my code about this error. I've got my app.js files inside my node JS application with the mongo-connect declaration : const MongoStore = require('connect-mongo')(session) And I've got this error : TypeError: Class constructor MongoStore cannot be invoked without 'new' at Object. (/Users/souhailmohamed/project/devops/story website/app.js:11:20) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Function.executeUserEntr