dify/web/service/oauth.ts
2026-01-02 18:48:52 +08:00

20 lines
537 B
TypeScript

import { post } from './base'
export type OAuthAppInfo = {
app_icon: string
app_label: Record<string, string>
scope: string
}
export type OAuthAuthorizeResponse = {
code: string
}
export const fetchOAuthAppInfo = (client_id: string, redirect_uri: string) => {
return post<OAuthAppInfo>('/oauth/provider', { body: { client_id, redirect_uri } }, { silent: true })
}
export const authorizeOAuthApp = (payload: { client_id: string }) => {
return post<OAuthAuthorizeResponse>('/oauth/provider/authorize', { body: payload })
}