mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Define auth.ServerUrl.
This commit is contained in:
parent
20b70c323d
commit
277dec0af3
@ -12,20 +12,20 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
export const GoogleAuthScope = "profile+email"
|
||||
export const GoogleAuthUri = "https://accounts.google.com/signin/oauth";
|
||||
export const GoogleAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_google.png";
|
||||
export const GithubAuthScope = "user:email+read:user"
|
||||
export const GithubAuthUri = "https://github.com/login/oauth/authorize";
|
||||
export const GithubAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_github.png";
|
||||
export const QqAuthScope = "get_user_info"
|
||||
export const QqAuthUri = "https://graph.qq.com/oauth2.0/authorize";
|
||||
export const QqAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_qq.png";
|
||||
export const WeChatAuthScope = "snsapi_login"
|
||||
export const WeChatAuthUri = "https://open.weixin.qq.com/connect/qrconnect";
|
||||
export const WeChatAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_wechat.png";
|
||||
const AuthState = "casdoor";
|
||||
|
||||
export const AuthState = "casdoor";
|
||||
const GoogleAuthScope = "profile+email"
|
||||
const GoogleAuthUri = "https://accounts.google.com/signin/oauth";
|
||||
const GoogleAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_google.png";
|
||||
const GithubAuthScope = "user:email+read:user"
|
||||
const GithubAuthUri = "https://github.com/login/oauth/authorize";
|
||||
const GithubAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_github.png";
|
||||
const QqAuthScope = "get_user_info"
|
||||
const QqAuthUri = "https://graph.qq.com/oauth2.0/authorize";
|
||||
const QqAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_qq.png";
|
||||
const WeChatAuthScope = "snsapi_login"
|
||||
const WeChatAuthUri = "https://open.weixin.qq.com/connect/qrconnect";
|
||||
const WeChatAuthLogo = "https://cdn.jsdelivr.net/gh/casbin/static/img/social_wechat.png";
|
||||
|
||||
export function getAuthLogo(provider) {
|
||||
if (provider.type === "google") {
|
||||
|
@ -14,15 +14,17 @@
|
||||
|
||||
import * as Setting from "../Setting";
|
||||
|
||||
const ServerUrl = Setting.ServerUrl;
|
||||
|
||||
export function getAccount() {
|
||||
return fetch(`${Setting.ServerUrl}/api/get-account`, {
|
||||
return fetch(`${ServerUrl}/api/get-account`, {
|
||||
method: 'GET',
|
||||
credentials: 'include'
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function register(values) {
|
||||
return fetch(`${Setting.ServerUrl}/api/register`, {
|
||||
return fetch(`${ServerUrl}/api/register`, {
|
||||
method: 'POST',
|
||||
credentials: "include",
|
||||
body: JSON.stringify(values),
|
||||
@ -30,7 +32,7 @@ export function register(values) {
|
||||
}
|
||||
|
||||
export function login(values) {
|
||||
return fetch(`${Setting.ServerUrl}/api/login`, {
|
||||
return fetch(`${ServerUrl}/api/login`, {
|
||||
method: 'POST',
|
||||
credentials: "include",
|
||||
body: JSON.stringify(values),
|
||||
@ -38,14 +40,14 @@ export function login(values) {
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return fetch(`${Setting.ServerUrl}/api/logout`, {
|
||||
return fetch(`${ServerUrl}/api/logout`, {
|
||||
method: 'POST',
|
||||
credentials: "include",
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function authLogin(providerName, code, state, redirectUrl, method) {
|
||||
return fetch(`${Setting.ServerUrl}/api/auth/login?provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&method=${method}`, {
|
||||
return fetch(`${ServerUrl}/api/auth/login?provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&method=${method}`, {
|
||||
method: 'GET',
|
||||
credentials: 'include',
|
||||
}).then(res => res.json());
|
||||
|
Loading…
x
Reference in New Issue
Block a user