-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(backend): Request paginated responses from BAPI (#3276)
ref: #3271 Co-authored-by: panteliselef <[email protected]>
- Loading branch information
1 parent
8ba8a0c
commit 8fbe238
Showing
8 changed files
with
45 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'@clerk/backend': patch | ||
--- | ||
|
||
Fix the following `@clerk/backend` methods to populate their paginated responses: | ||
- `clerkClient.allowListIndentifiers.getAllowlistIdentifierList()` | ||
- `clerkClient.clients.getClientList()` | ||
- `clerkClient.invitations.getInvitationList` | ||
- `clerkClient.redirectUrls.getRedirectUrlList()` | ||
- `clerkClient.sessions.getSessionList()` | ||
- `clerkClient.users.getUserOauthAccessToken()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,37 +214,43 @@ export default (QUnit: QUnit) => { | |
}); | ||
|
||
test('successfully retrieves user access tokens from backend API for a specific provider', async assert => { | ||
const fakeResponse = [ | ||
{ | ||
external_account_id: 'eac_2dYS7stz9bgxQsSRvNqEAHhuxvW', | ||
object: 'oauth_access_token', | ||
token: '<token>', | ||
provider: 'oauth_google', | ||
public_metadata: {}, | ||
label: null, | ||
scopes: ['email', 'profile'], | ||
}, | ||
]; | ||
const fakeResponse = { | ||
data: [ | ||
{ | ||
external_account_id: 'eac_2dYS7stz9bgxQsSRvNqEAHhuxvW', | ||
object: 'oauth_access_token', | ||
token: '<token>', | ||
provider: 'oauth_google', | ||
public_metadata: {}, | ||
label: null, | ||
scopes: ['email', 'profile'], | ||
}, | ||
], | ||
total_count: 1, | ||
}; | ||
|
||
fakeFetch = sinon.stub(runtime, 'fetch'); | ||
fakeFetch.onCall(0).returns(jsonOk(fakeResponse)); | ||
|
||
const response = await apiClient.users.getUserOauthAccessToken('user_deadbeef', 'oauth_google'); | ||
|
||
assert.equal(response[0].externalAccountId, 'eac_2dYS7stz9bgxQsSRvNqEAHhuxvW'); | ||
assert.equal(response[0].provider, 'oauth_google'); | ||
assert.equal(response[0].token, '<token>'); | ||
assert.deepEqual(response[0].scopes, ['email', 'profile']); | ||
assert.equal(response.data[0].externalAccountId, 'eac_2dYS7stz9bgxQsSRvNqEAHhuxvW'); | ||
assert.equal(response.data[0].provider, 'oauth_google'); | ||
assert.equal(response.data[0].token, '<token>'); | ||
assert.deepEqual(response.data[0].scopes, ['email', 'profile']); | ||
|
||
assert.ok( | ||
fakeFetch.calledOnceWith('https://api.clerk.test/v1/users/user_deadbeef/oauth_access_tokens/oauth_google', { | ||
method: 'GET', | ||
headers: { | ||
Authorization: 'Bearer deadbeef', | ||
'Content-Type': 'application/json', | ||
'User-Agent': '@clerk/[email protected]', | ||
fakeFetch.calledOnceWith( | ||
'https://api.clerk.test/v1/users/user_deadbeef/oauth_access_tokens/oauth_google?paginated=true', | ||
{ | ||
method: 'GET', | ||
headers: { | ||
Authorization: 'Bearer deadbeef', | ||
'Content-Type': 'application/json', | ||
'User-Agent': '@clerk/[email protected]', | ||
}, | ||
}, | ||
}), | ||
), | ||
); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters