@hotosm/hanko-auth 0.4.10 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hanko-auth.esm.js +294 -293
- package/dist/hanko-auth.iife.js +12 -12
- package/dist/hanko-auth.umd.js +12 -12
- package/package.json +2 -2
- package/src/hanko-auth.ts +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotosm/hanko-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Web component for HOTOSM SSO authentication with Hanko and OSM integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/hanko-auth.umd.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"url": "https://github.com/hotosm/login/issues"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@teamhanko/hanko-elements": "^
|
|
49
|
+
"@teamhanko/hanko-elements": "^2.5.0",
|
|
50
50
|
"lit": "^3.3.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
package/src/hanko-auth.ts
CHANGED
|
@@ -610,12 +610,12 @@ export class HankoAuth extends LitElement {
|
|
|
610
610
|
if (needsSdkFallback) {
|
|
611
611
|
this.log("Using SDK to get user with email");
|
|
612
612
|
// Fallback to SDK method which has email
|
|
613
|
-
const user = await this._hanko.
|
|
613
|
+
const user = await this._hanko.getCurrentUser();
|
|
614
614
|
this.user = {
|
|
615
|
-
id: user.
|
|
616
|
-
email: user.
|
|
617
|
-
username: user.username,
|
|
618
|
-
emailVerified: user.
|
|
615
|
+
id: user.user_id,
|
|
616
|
+
email: user.emails?.[0]?.address || null,
|
|
617
|
+
username: user.username?.username || null,
|
|
618
|
+
emailVerified: user.emails?.[0]?.is_verified || false,
|
|
619
619
|
};
|
|
620
620
|
}
|
|
621
621
|
} catch (userError) {
|
|
@@ -1016,14 +1016,14 @@ export class HankoAuth extends LitElement {
|
|
|
1016
1016
|
setTimeout(() => reject(new Error("SDK timeout")), 5000),
|
|
1017
1017
|
);
|
|
1018
1018
|
const user = (await Promise.race([
|
|
1019
|
-
this._hanko.
|
|
1019
|
+
this._hanko.getCurrentUser(),
|
|
1020
1020
|
timeoutPromise,
|
|
1021
1021
|
])) as any;
|
|
1022
1022
|
this.user = {
|
|
1023
|
-
id: user.
|
|
1024
|
-
email: user.
|
|
1025
|
-
username: user.username,
|
|
1026
|
-
emailVerified: user.
|
|
1023
|
+
id: user.user_id,
|
|
1024
|
+
email: user.emails?.[0]?.address || null,
|
|
1025
|
+
username: user.username?.username || null,
|
|
1026
|
+
emailVerified: user.emails?.[0]?.is_verified || false,
|
|
1027
1027
|
};
|
|
1028
1028
|
userInfoRetrieved = true;
|
|
1029
1029
|
this.log("User info retrieved via SDK fallback");
|
|
@@ -1150,7 +1150,7 @@ export class HankoAuth extends LitElement {
|
|
|
1150
1150
|
// This is a redirect response
|
|
1151
1151
|
const redirectUrl = response.headers.get("Location") || response.url;
|
|
1152
1152
|
this.log("Got redirect URL:", redirectUrl);
|
|
1153
|
-
|
|
1153
|
+
window.location.href = redirectUrl;
|
|
1154
1154
|
} else if (response.status >= 300 && response.status < 400) {
|
|
1155
1155
|
const redirectUrl = response.headers.get("Location");
|
|
1156
1156
|
this.log("Got redirect URL from header:", redirectUrl);
|
|
@@ -1201,7 +1201,7 @@ export class HankoAuth extends LitElement {
|
|
|
1201
1201
|
|
|
1202
1202
|
if (this._hanko) {
|
|
1203
1203
|
try {
|
|
1204
|
-
await this._hanko.
|
|
1204
|
+
await this._hanko.logout();
|
|
1205
1205
|
this.log("Hanko logout successful");
|
|
1206
1206
|
} catch (error) {
|
|
1207
1207
|
this.logError("Hanko logout failed:", error);
|