Skip to content

Commit

Permalink
feat: Add external_account_id to OAuth access token response (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
kostaspt authored Mar 12, 2024
1 parent 06760da commit 5151b40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions oauth_access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package clerk
import "encoding/json"

type OAuthAccessToken struct {
Object string `json:"object"`
Token string `json:"token"`
Provider string `json:"provider"`
PublicMetadata json.RawMessage `json:"public_metadata"`
Label *string `json:"label"`
ExternalAccountID string `json:"external_account_id"`
Object string `json:"object"`
Token string `json:"token"`
Provider string `json:"provider"`
PublicMetadata json.RawMessage `json:"public_metadata"`
Label *string `json:"label"`
// Only set in OAuth 2.0 tokens
Scopes []string `json:"scopes,omitempty"`
// Only set in OAuth 1.0 tokens
Expand Down
2 changes: 2 additions & 0 deletions user/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func TestUserClientListOAuthAccessTokens(t *testing.T) {
T: t,
Out: json.RawMessage(fmt.Sprintf(`{
"data":[{
"external_account_id":"eac_2dYS7stz9bgxQsSRvNqEAHhuxvW",
"provider":"%s",
"token":"the-token"
}],
Expand All @@ -236,6 +237,7 @@ func TestUserClientListOAuthAccessTokens(t *testing.T) {
require.NoError(t, err)
require.Equal(t, int64(1), list.TotalCount)
require.Equal(t, 1, len(list.OAuthAccessTokens))
require.Equal(t, "eac_2dYS7stz9bgxQsSRvNqEAHhuxvW", list.OAuthAccessTokens[0].ExternalAccountID)
require.Equal(t, provider, list.OAuthAccessTokens[0].Provider)
}

Expand Down

0 comments on commit 5151b40

Please sign in to comment.