✨ feat(auth): Add Oauth configuration for Telegram, Facebook, Google, Github, and Apple
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as auth from './auth';
|
||||
import * as common from './common';
|
||||
import * as oauth from './oauth';
|
||||
export default {
|
||||
auth,
|
||||
oauth,
|
||||
common,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** Apple Login Callback POST /v1/auth/oauth/callback/apple */
|
||||
export async function appleLoginCallback(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/apple', {
|
||||
method: 'POST',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Facebook Login Callback GET /v1/auth/oauth/callback/facebook */
|
||||
export async function facebookLoginCallback(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/facebook', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Google Login Callback GET /v1/auth/oauth/callback/google */
|
||||
export async function googleLoginCallback(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/google', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Telegram Login Callback GET /v1/auth/oauth/callback/telegram */
|
||||
export async function telegramLoginCallback(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>('/v1/auth/oauth/callback/telegram', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** OAuth login POST /v1/auth/oauth/login */
|
||||
export async function oAuthLogin(body: API.OAthLoginRequest, options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.OAuthLoginResponse }>('/v1/auth/oauth/login', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
+20
@@ -205,6 +205,26 @@ declare namespace API {
|
||||
last_at: number;
|
||||
};
|
||||
|
||||
type OAthLoginRequest = {
|
||||
/** google, facebook, apple, telegram, github etc. */
|
||||
method: string;
|
||||
};
|
||||
|
||||
type OAuthConfig = {
|
||||
id: number;
|
||||
platform: 'github' | 'google' | 'apple' | 'qq' | 'wechat' | 'telegram' | 'facebook';
|
||||
team_id: string;
|
||||
key_id: string;
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
redirect: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
|
||||
type OAuthLoginResponse = {
|
||||
redirect: string;
|
||||
};
|
||||
|
||||
type OnlineUser = {
|
||||
uid: number;
|
||||
ip: string;
|
||||
|
||||
Reference in New Issue
Block a user