Skip to content

Commit

Permalink
a comment explaining some weirdness
Browse files Browse the repository at this point in the history
  • Loading branch information
tlangs committed Mar 22, 2024
1 parent 8909179 commit 9798279
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/profile/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const Profile = (): ReactNode => {
}
}, [profileStatus]);

// This coalescing is needed due to a peculiarity in the way Nav works.
// When the user is redirected back to the app from an external oauth provider,
// we need to grab the `state` and `code` query params from the URL.
// Not all providers order the query params and href the same way, and this seems to break Nav.useRoute query parsing.
const { query, name } = Nav.useRoute();
const { state, code } = qs.parse(window.location.search, { ignoreQueryPrefix: true });
let coalescedQuery = {};
Expand Down
2 changes: 1 addition & 1 deletion src/profile/external-identities/OAuth2Providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export type OAuth2Provider = {
};

const createRedirectUri = (callback: OAuth2Callback['link']) => {
// return `${window.location.hostname === 'localhost' ? getConfig().devUrlRoot : window.location.origin}/${callback}`;
return `${window.location.origin}/${callback}`;
};

export const oauth2Provider = (providerKey: OAuth2ProviderKey): OAuth2Provider => {
switch (providerKey) {
case 'github':
Expand Down

0 comments on commit 9798279

Please sign in to comment.