Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update example to fit new data structure #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ var template = handlebars.compile(`
<table>
<tr><th>Access Token</th><td>{{accessToken}}</td></tr>
<tr><th>Refresh Token</th><td>{{refreshToken}}</td></tr>
<tr><th>Display Name</th><td>{{display_name}}</td></tr>
<tr><th>Bio</th><td>{{bio}}</td></tr>
<tr><th>Image</th><td>{{logo}}</td></tr>
</table></html>`);
<tr><th>Display Name</th><td>{{data.[0].display_name}}</td></tr>
<tr><th>Bio</th><td>{{data.[0].description}}</td></tr>
<tr><th>Image</th><td>{{data.[0].profile_image_url}}</td></tr>
</table>
</html>`);

// If user has an authenticated session, display it, otherwise display link to authenticate
app.get('/', function (req, res) {
if(req.session && req.session.passport && req.session.passport.user) {
console.log(req.session.passport.user);
res.send(template(req.session.passport.user));
} else {
res.send('<html><head><title>Twitch Auth Sample</title></head><a href="/auth/twitch"><img src="http://ttv-api.s3.amazonaws.com/assets/connect_dark.png"></a></html>');
Expand Down