Skip to content

Commit d4c5e0d

Browse files
author
Logan Gingerich
authored
Corrections in setting client_id / project_id (#309)
* Corrections in setting client_id / project_id * snapshot update
1 parent 953f6e2 commit d4c5e0d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/sso/__snapshots__/sso.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ exports[`SSO SSO getAuthorizationURL with a provider generates an authorize url
66

77
exports[`SSO SSO getAuthorizationURL with no custom api hostname generates an authorize url with the default api hostname 1`] = `"https://api.workos.com/sso/authorize?client_id=proj_123&domain=lyft.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code"`;
88

9-
exports[`SSO SSO getAuthorizationURL with no custom api hostname with projectID instead of clientID generates an authorize url with the default api hostname 1`] = `"https://api.workos.com/sso/authorize?domain=lyft.com&project_id=proj_123&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code"`;
9+
exports[`SSO SSO getAuthorizationURL with no custom api hostname with projectID instead of clientID generates an authorize url with the default api hostname 1`] = `"https://api.workos.com/sso/authorize?client_id=proj_123&domain=lyft.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code"`;
1010

1111
exports[`SSO SSO getAuthorizationURL with no domain or provider throws an error for incomplete arguments 1`] = `"Incomplete arguments. Need to specify either a 'domain' or 'provider'."`;
1212

1313
exports[`SSO SSO getAuthorizationURL with state generates an authorize url with the provided state 1`] = `"https://api.workos.com/sso/authorize?client_id=proj_123&domain=lyft.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom%20state"`;
1414

15-
exports[`SSO SSO getProfile with a projectID instead of clientID sends a request to the WorkOS api for a profile 1`] = `"project_id=proj_123&client_secret=sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU&grant_type=authorization_code&code=authorization_code"`;
15+
exports[`SSO SSO getProfile with a projectID instead of clientID sends a request to the WorkOS api for a profile 1`] = `"client_id=proj_123&client_secret=sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU&grant_type=authorization_code&code=authorization_code"`;
1616

1717
exports[`SSO SSO getProfile with a projectID instead of clientID sends a request to the WorkOS api for a profile 2`] = `
1818
Object {

src/sso/sso.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ export class SSO {
4141
const query = queryString.stringify({
4242
domain,
4343
provider,
44-
client_id: clientID,
45-
project_id: projectID,
44+
client_id: clientID ?? projectID,
4645
redirect_uri: redirectURI,
4746
response_type: 'code',
4847
state,
@@ -65,7 +64,7 @@ export class SSO {
6564
if (clientID) {
6665
form.set('client_id', clientID);
6766
} else if (projectID) {
68-
form.set('project_id', projectID);
67+
form.set('client_id', projectID);
6968
}
7069
form.set('client_secret', this.workos.key as string);
7170
form.set('grant_type', 'authorization_code');

0 commit comments

Comments
 (0)