-
Notifications
You must be signed in to change notification settings - Fork 143
Add Eventbrite Authentication #38
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
base: master
Are you sure you want to change the base?
Changes from 12 commits
74dcb91
008d614
55e80e0
11a8f1f
093f597
e5b1d2a
769022a
ef400f6
936a554
2916108
ad82fc5
a2e12f3
958c24d
faa3190
9313f6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ const Index = ({profile, origin}) => ( | |
<h2 className='subtitle is-4'> | ||
Stateless authentication microservice for | ||
<ul> | ||
{['Twitter', 'Facebook', 'Google', 'GitHub', 'Reddit', 'LinkedIn', 'Instagram'].map(name => <Item name={name} key={name} />)} | ||
{['Twitter', 'Facebook', 'Google', 'GitHub', 'Reddit', 'LinkedIn', 'Instagram', 'Eventbrite'].map(name => <Item name={name} key={name} />)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will not feature every login strategy on the demo page. Could you remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am in two minds about this
=> The auth buttons that are needed to be enabled or disabled should be configurable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The login-with.com page (and the related demo code) is not meant to be deployed by anyone else. The respective user / developer can configure which strategies to use via environment variables. To test a specific strategy, you can directly connect (from browser) to your auth endpoint (e.g. auth.login-with.com/twitter or auth.your-service.com/eventbrite) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</ul> | ||
</h2> | ||
{ profile | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ const Login = ({profile, origin}) => { | |
const redirect = encodeURIComponent(origin + '/') | ||
return ( | ||
<div className='section'> | ||
{ !profile && ['Twitter', 'Google', 'GitHub', 'Reddit', 'Facebook', 'LinkedIn', 'Instagram'].map(service => ( | ||
{ !profile && ['Twitter', 'Google', 'GitHub', 'Reddit', 'Facebook', 'LinkedIn', 'Instagram', 'Eventbrite'].map(service => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will not feature every login strategy on the demo page. Could you remove this? |
||
<LoginWith key={service} service={service} redirect={redirect} /> | ||
)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ const cookieParser = require('cookie-parser') | |
const expressSession = require('express-session') | ||
const MemoryStore = require('session-memory-store')(expressSession) | ||
|
||
require('dotenv').config() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if we really should use it... do you have some hoster/deployment scenario which honors this way to pass env? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use is mostly for local deployment or when not using Docker ....especially when we are deploying directly to cloud like EC2 instances, we can just deploy .env file along with the production bundle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
||
const opts = require('./src/opts')(process.argv, process.env) | ||
|
||
if (!opts.tokenSecret) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ | |
"instagram", | ||
"github", | ||
"google", | ||
"passport" | ||
"passport", | ||
"eventbrite" | ||
], | ||
"author": "Gerhard Preuss", | ||
"license": "MIT", | ||
|
@@ -35,6 +36,7 @@ | |
"cookie-parser": "^1.4.3", | ||
"express": "^4.14.0", | ||
"express-session": "^1.14.2", | ||
"dotenv-extended": "^2.0.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need extended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really need this? isn't dotenv enough? |
||
"jsonwebtoken": "^7.2.1", | ||
"passport": "^0.3.2", | ||
"passport-facebook": "^2.1.1", | ||
|
@@ -46,6 +48,7 @@ | |
"passport-reddit": "^0.2.4", | ||
"passport-strategy": "^1.0.0", | ||
"passport-twitter": "^1.0.4", | ||
"passport-eventbrite-oauth": "0.0.3", | ||
"session-memory-store": "^0.2.2" | ||
}, | ||
"devDependencies": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
Ctor: require('passport-eventbrite-oauth').OAuth2Strategy, | ||
getConfig: (env, callbackURL) => { | ||
const clientID = env.LW_EVENTBRITE_CLIENTID | ||
const clientSecret = env.LW_EVENTBRITE_CLIENTSECRET | ||
if (clientID && clientSecret) { | ||
return { | ||
clientID, | ||
clientSecret, | ||
callbackURL | ||
} | ||
} | ||
}, | ||
|
||
toUser: (accessToken, refreshToken, profile, done) => { | ||
const {id, displayName} = profile | ||
done(null, { | ||
accessToken, | ||
refreshToken, | ||
profile: { | ||
username: id, | ||
name: displayName, | ||
provider: 'eventbrite' | ||
} | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good watch! THX