user1803975
user1803975

Reputation: 355

oauth.io node sdk - dynamic provider

I'm using the oauth.io node sdk for server side authentication and I want to authorise multiple providers on my app, I'm just wondering if there is a way of doing it without having to create a separate endpoint for each one.

Something like this is what I'm after but the authorisation function doesn't seem to work when wrapped in a container function.

app.get('/signin', function(req, res){
  OAuth.auth(req.param.provider, 'http://localhost:8080/oauth/redirect')
});

Upvotes: 0

Views: 46

Answers (1)

user1803975
user1803975

Reputation: 355

Found answer thanks to thyb in this post

https://github.com/oauth-io/sdk-node/issues/14

app.get('/signin/:provider', function(req, res) {
  OAuth.auth(req.param.provider, 'http://localhost:8080/oauth/redirect')(req, res);
});

Upvotes: 0

Related Questions