simplified duplicated code (#1935)
This commit is contained in:
parent
11dec0c80a
commit
026a1339c7
1 changed files with 5 additions and 7 deletions
|
|
@ -545,13 +545,11 @@ func parseTokenResponse(body []byte, provider string) (*AuthCredential, error) {
|
||||||
AuthMethod: "oauth",
|
AuthMethod: "oauth",
|
||||||
}
|
}
|
||||||
|
|
||||||
if accountID := extractAccountID(tokenResp.IDToken); accountID != "" {
|
|
||||||
cred.AccountID = accountID
|
|
||||||
} else if accountID := extractAccountID(tokenResp.AccessToken); accountID != "" {
|
|
||||||
cred.AccountID = accountID
|
|
||||||
} else if accountID := extractAccountID(tokenResp.IDToken); accountID != "" {
|
|
||||||
// Recent OpenAI OAuth responses may only include chatgpt_account_id in id_token claims.
|
// Recent OpenAI OAuth responses may only include chatgpt_account_id in id_token claims.
|
||||||
cred.AccountID = accountID
|
if id := extractAccountID(tokenResp.IDToken); id != "" {
|
||||||
|
cred.AccountID = id
|
||||||
|
} else if id := extractAccountID(tokenResp.AccessToken); id != "" {
|
||||||
|
cred.AccountID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
return cred, nil
|
return cred, nil
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue