fix: handle authorization code format in ExchangeCode function and update placeholder in EditChannelModal
This commit is contained in:
@@ -103,6 +103,13 @@ func GenerateOAuthParams() (*OAuth2Credentials, error) {
|
|||||||
func ExchangeCode(authorizationCode, codeVerifier, state string, client *http.Client) (*oauth2.Token, error) {
|
func ExchangeCode(authorizationCode, codeVerifier, state string, client *http.Client) (*oauth2.Token, error) {
|
||||||
config := getOAuthConfig()
|
config := getOAuthConfig()
|
||||||
|
|
||||||
|
if strings.Contains(authorizationCode, "#") {
|
||||||
|
parts := strings.Split(authorizationCode, "#")
|
||||||
|
if len(parts) > 0 {
|
||||||
|
authorizationCode = parts[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
if client != nil {
|
if client != nil {
|
||||||
ctx = context.WithValue(ctx, oauth2.HTTPClient, client)
|
ctx = context.WithValue(ctx, oauth2.HTTPClient, client)
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ import {
|
|||||||
IconSetting,
|
IconSetting,
|
||||||
} from '@douyinfe/semi-icons';
|
} from '@douyinfe/semi-icons';
|
||||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { copy, getChannelIcon, getChannelModels, getModelCategories, modelSelectFilter } from '../../../../helpers';
|
|
||||||
|
|
||||||
import { useIsMobile } from '../../../../hooks/common/useIsMobile.js';
|
import { useIsMobile } from '../../../../hooks/common/useIsMobile.js';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -1853,7 +1852,7 @@ const EditChannelModal = (props) => {
|
|||||||
<Input
|
<Input
|
||||||
value={authorizationCode}
|
value={authorizationCode}
|
||||||
onChange={setAuthorizationCode}
|
onChange={setAuthorizationCode}
|
||||||
placeholder={t('请输入授权码或回调URL')}
|
placeholder={t('请输入授权码')}
|
||||||
showClear
|
showClear
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user