Skip to content

Commit 2a12677

Browse files
committed
Implement OAuth redirect_uri handling for sign in
1 parent 805b9cc commit 2a12677

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/components/SignInButton/SignInButton.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ export class SignInButton extends Component {
3030

3131
this.setState({ clicked: true });
3232

33+
const frontendOrigin = window.env.REACT_APP_URL || window.location.origin;
3334
const loginUrl = `${window.env.REACT_APP_SERVER_OAUTH_URL}${encodeURIComponent(
3435
this.props.history?.location?.pathname + this.props.history?.location?.search,
35-
)}`;
36+
)}&redirect_uri=${encodeURIComponent(frontendOrigin)}`;
3637

3738
fetch(loginUrl)
3839
.then(async (result) => {

src/services/User/User.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ export const fetchBasicUser = function (userId) {
316316
* @param authCode - the token
317317
*/
318318
export const callback = async (authCode, dispatch, push) => {
319-
const resetURI = `${window.env.REACT_APP_MAP_ROULETTE_SERVER_URL}/auth/callback?code=${authCode}`;
319+
const frontendOrigin = window.env.REACT_APP_URL || window.location.origin;
320+
const resetURI = `${window.env.REACT_APP_MAP_ROULETTE_SERVER_URL}/auth/callback?code=${authCode}&redirect_uri=${encodeURIComponent(frontendOrigin)}`;
320321

321322
// Since we're bypassing Endpoint and manually performing an update, we
322323
// need to also manually reset the request cache.

0 commit comments

Comments
 (0)