Skip to content

Commit 0f0445d

Browse files
author
dongfengtao
committed
fix:高教社 版本
1 parent 5fd93b5 commit 0f0445d

6 files changed

Lines changed: 21 additions & 19 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 不要自己 build
2+
# 不要自己 npm test

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authing/sso",
3-
"version": "2.1.30-alpha.3",
3+
"version": "2.1.31-hep.1",
44
"description": "Authing SSO SDK 为开发者提供了简单易用的函数来实现 Web 端的单点登录效果,你可以通过调用 SDK 与 Authing 完成集成,为你的多个业务软件实现浏览器内的单点登录效果。",
55
"main": "build/umd",
66
"typings": "build/types",

src/example.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ const auth = new AuthingSSO({
1919

2020
window.onload = async function () {
2121

22-
let etextbookproRes = await auth.onIdentitySourceVerifLogin({
23-
ext_idp_conn_id: '69c4acdc5e538db374a7021e',
24-
referrer: 'https://lifelong.smartedu.cn'
25-
})
22+
// await auth.onIdentitySourceVerifLogin()
23+
2624

27-
console.log(etextbookproRes,'etextbookproRes')
2825
let res = await auth.trackSession()
26+
console.log(res,'resres')
2927
if (res.session !== null) {
3028
document.getElementById('h1-user-info').style.display = 'block'
3129
document.getElementById('user-info').innerHTML = JSON.stringify(res.userInfo, null, 4)

src/index.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,13 @@ export class AuthingSSO {
420420
.nonce(Math.random().toString())
421421
.extIdpConnId(ext_idp_conn_id)
422422
.build();
423-
if (isInElectron) {
424-
window.open(url.href);
425-
} else {
426-
window.location.href = url.href;
427-
}
423+
424+
console.log(url.href,'url.hrefurl.hrefurl.href deugger')
425+
// if (isInElectron) {
426+
// window.open(url.href);
427+
// } else {
428+
// window.location.href = url.href;
429+
// }
428430
}
429431

430432
/**
@@ -511,7 +513,7 @@ export class AuthingSSO {
511513
timeoutId = setTimeout(() => {
512514
cleanup();
513515
reject({ error: "timeout" });
514-
}, 5000); // 5 秒超时
516+
}, 2800); // 2.8 秒超时
515517

516518
window.addEventListener("message", messageHandler);
517519
});
@@ -530,7 +532,8 @@ export class AuthingSSO {
530532
// 如果传入的 ext_idp_conn_id 存在,优先使用
531533
if (!params?.ext_idp_conn_id) {
532534
// 调用接口获取 ext_idp_conn_id
533-
const domain = params?.referrer || referrerReferrer || "https://lifelong.smartedu.cn/";
535+
const domain = referrerReferrer || "lifelong.smartedu.cn";
536+
// const domain = "lifelong.smartedu.cn";
534537
const matchConnRes: any = await this._axios.get(MATCH_CONN, {
535538
params: {
536539
app_id: this.appId,
@@ -553,11 +556,10 @@ export class AuthingSSO {
553556

554557

555558
// 如果传入的 ext_idp_conn_id 存在,优先使用
556-
557559
if (params?.referrer ) {
558560
console.log(params?.referrer,referrerReferrer,'referrerparams debugger')
559561
if(params?.referrer !== referrerReferrer){
560-
// return null
562+
return null
561563
}
562564
}
563565

@@ -582,7 +584,7 @@ export class AuthingSSO {
582584
} catch (e) {
583585
// iframe 登录异常,fallback 到跳转登录
584586
console.log(e,'eeeeeeee debugger')
585-
// this.loginEtextbookpro(ext_idp_conn_id);
587+
this.loginEtextbookpro(ext_idp_conn_id);
586588
}
587589
}
588590
}

src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function getReferrerOrigin(): string {
2121
if (!referrer) return '';
2222

2323
const url = new URL(referrer);
24-
return `${url.protocol}//${url.host}`;
24+
return `${url.host}`;
2525
} catch {
2626
return '';
2727
}

0 commit comments

Comments
 (0)