Full-Stack Web Development with Vue.js and Node

(singke) #1
Building OAuth Strategies with passport.js Chapter 7

Now, we should be able to log in via Facebook. When the login function is successful, it


will redirect the user to the home page. If you notice, Facebook redirects us to


http://localhost:8081/#= instead of just http://localhost:8081. This is because


of a security vulnerability. We can remove the # from the URL by adding the following


piece of code in the main file, which is index.html:


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Materi
al+Icons" rel="stylesheet">
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css"
rel="stylesheet">
<title>movie_rating_app</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<script type="text/javascript">
if (window.location.hash == '#_=_'){
history.replaceState
? history.replaceState(null, null,
window.location.href.split('#')[0])
: window.location.hash = '';
}
</script>
</html>

This will remove the # symbol from the preceding URL. When you are successfully logged


in, we should see your email in the top bar view similar to this:

Free download pdf