Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
20 changes: 17 additions & 3 deletions 20 packages/authentication-oauth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,32 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => {
}

const { strategyNames } = service;

// Set up all the defaults
const { path = '/oauth' } = oauth.defaults || {};
const port = app.get('port');
let host = app.get('host');
let protocol = 'https';

// Development environments commonly run on HTTP with an extended port
if (app.get('env') === 'development') {
protocol = 'http';
if (String(port) !== '80') {
host += ':' + port;
}
}

const grant = merge({
defaults: {
path,
host: `${app.get('host')}:${app.get('port')}`,
protocol: app.get('env') === 'production' ? 'https' : 'http',
host,
protocol,
transport: 'session'
}
}, omit(oauth, 'redirect'));

const getUrl = (url: string) => {
const { defaults } = grant;

return `${defaults.protocol}://${defaults.host}${path}/${url}`;
};

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.