@quatrain/auth-supabase 1.1.16 → 1.1.17
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.
|
@@ -11,7 +11,7 @@ export declare class SupabaseAuthAdapter extends AbstractAuthAdapter {
|
|
|
11
11
|
register(user: User, clearPassword?: string): Promise<any>;
|
|
12
12
|
getAuthToken(bearer: string): Promise<any>;
|
|
13
13
|
refreshToken(refreshToken: string): Promise<any>;
|
|
14
|
-
revokeAuthToken(token: string): Promise<
|
|
14
|
+
revokeAuthToken(token: string): Promise<false | undefined>;
|
|
15
15
|
signup(login: string, password: string): Promise<false | {
|
|
16
16
|
user: any;
|
|
17
17
|
session: any;
|
|
@@ -107,6 +107,10 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
|
107
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
108
|
// Careful, this only delete tokens on client side, not on server side
|
|
109
109
|
const { error } = yield this.signout();
|
|
110
|
+
if (error !== null) {
|
|
111
|
+
auth_1.Auth.error(error);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
110
114
|
});
|
|
111
115
|
}
|
|
112
116
|
signup(login, password) {
|
|
@@ -116,7 +120,7 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
|
116
120
|
password,
|
|
117
121
|
});
|
|
118
122
|
if (error !== null) {
|
|
119
|
-
auth_1.Auth.
|
|
123
|
+
auth_1.Auth.error(error);
|
|
120
124
|
return false;
|
|
121
125
|
}
|
|
122
126
|
return { user: data.user, session: data.session };
|
|
@@ -124,7 +128,7 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
|
124
128
|
}
|
|
125
129
|
signout() {
|
|
126
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const {
|
|
131
|
+
const { error } = yield this._client.auth.signOut();
|
|
128
132
|
if (error !== null) {
|
|
129
133
|
auth_1.Auth.error(error);
|
|
130
134
|
return false;
|
|
@@ -138,13 +142,16 @@ class SupabaseAuthAdapter extends auth_1.AbstractAuthAdapter {
|
|
|
138
142
|
try {
|
|
139
143
|
if (Object.keys(updatable).length > 0) {
|
|
140
144
|
auth_1.Auth.info(`Updating ${updatable.displayName} Auth record`);
|
|
141
|
-
const {
|
|
145
|
+
const { error } = yield this._client.auth.admin.updateUserById(user.uid, updatable);
|
|
142
146
|
if (error !== null) {
|
|
143
|
-
auth_1.Auth.
|
|
147
|
+
auth_1.Auth.error(error);
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
|
-
catch (e) {
|
|
151
|
+
catch (e) {
|
|
152
|
+
auth_1.Auth.error(e);
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
148
155
|
});
|
|
149
156
|
}
|
|
150
157
|
delete(user) {
|