File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
packages/authentication-oauth/src Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,32 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => {
2424 }
2525
2626 const { strategyNames } = service ;
27+
28+ // Set up all the defaults
2729 const { path = '/oauth' } = oauth . defaults || { } ;
30+ const port = app . get ( 'port' ) ;
31+ let host = app . get ( 'host' ) ;
32+ let protocol = 'https' ;
33+
34+ // Development environments commonly run on HTTP with an extended port
35+ if ( app . get ( 'env' ) === 'development' ) {
36+ protocol = 'http' ;
37+ if ( String ( port ) !== '80' ) {
38+ host += ':' + port ;
39+ }
40+ }
41+
2842 const grant = merge ( {
2943 defaults : {
3044 path,
31- host : ` ${ app . get ( 'host' ) } : ${ app . get ( 'port' ) } ` ,
32- protocol : app . get ( 'env' ) === 'production' ? 'https' : 'http' ,
45+ host,
46+ protocol,
3347 transport : 'session'
3448 }
3549 } , omit ( oauth , 'redirect' ) ) ;
50+
3651 const getUrl = ( url : string ) => {
3752 const { defaults } = grant ;
38-
3953 return `${ defaults . protocol } ://${ defaults . host } ${ path } /${ url } ` ;
4054 } ;
4155
You can’t perform that action at this time.
0 commit comments