Skip to content

Commit

Permalink
Fix oauth url separator
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello committed Feb 14, 2025
1 parent 1ad5e06 commit 25c31a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/containers/LoginServices/serviceLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export const onPressCustomOAuth = ({ loginService, server }: { loginService: IIt
const { serverURL, authorizePath, clientId, scope, service } = loginService;
const redirectUri = `${server}/_oauth/${service}`;
const state = getOAuthState();
const params = `?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code&state=${state}&scope=${scope}`;
const separator = authorizePath.indexOf('?') !== -1 ? '&' : '?';
const params = `${separator}client_id=${clientId}&redirect_uri=${encodeURIComponent(
redirectUri
)}&response_type=code&state=${state}&scope=${encodeURIComponent(scope)}`;
const domain = `${serverURL}`;
const absolutePath = `${authorizePath}${params}`;
const url = absolutePath.includes(domain) ? absolutePath : domain + absolutePath;
Expand Down

0 comments on commit 25c31a6

Please sign in to comment.