Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Carl Godkin
osdu-tutorials-react
Commits
bcb43f39
Commit
bcb43f39
authored
Jan 14, 2020
by
Valiantsin
Browse files
fix: authentication
parent
2f16f465
Changes
3
Hide whitespace changes
Inline
Side-by-side
quickstart/server.js
View file @
bcb43f39
...
...
@@ -34,16 +34,7 @@ app.use(
const
authProxyPort
=
process
.
env
.
AUTH_SERVER_PORT
||
'
8080
'
;
const
authProxyHost
=
process
.
env
.
AUTH_SERVER_HOST
||
'
server
'
;
app
.
use
(
proxy
(
'
/api/login
'
,
{
target
:
`http://
${
authProxyHost
}
:
${
authProxyPort
}
`
,
pathRewrite
:
{
'
^/api
'
:
'
/
'
,
// rewrite path
},
})
);
app
.
use
(
proxy
(
'
/auth
'
,
{
proxy
(
'
/login
'
,
{
target
:
`http://
${
authProxyHost
}
:
${
authProxyPort
}
`
,
})
);
...
...
quickstart/src/api/auth.api.ts
View file @
bcb43f39
import
{
handleErrors
}
from
'
./handleErrors
'
;
export
async
function
login
():
Promise
<
void
>
{
// temporary hardcode redirect URL for login
window
.
open
(
`http://localhost:8080/login`
,
'
_blank
'
);
// return fetch(`http://localhost:8080/login`)
// .then(handleErrors)
// .then(response => response.json());
export
function
login
():
void
{
// eslint-disable-next-line no-restricted-globals
location
.
replace
(
'
/login
'
);
}
quickstart/src/setupProxy.js
View file @
bcb43f39
...
...
@@ -16,12 +16,4 @@ module.exports = function(app) {
},
})
);
app
.
use
(
proxy
(
'
/api/auth
'
,
{
target
:
'
http://localhost:8080
'
,
pathRewrite
:
{
'
^/api
'
:
'
/
'
,
// rewrite path
},
})
);
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment