Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add external_account_id to OAuth access token response (v2) #275

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions oauth_access_token.go
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
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