@supabase/auth-js 2.107.0-canary.1 → 2.107.0-canary.2
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/main/GoTrueAdminApi.d.ts +0 -1
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js +7 -20
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +15 -0
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +15 -0
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/GoTrueAdminApi.d.ts +0 -1
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js +8 -21
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +15 -0
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +15 -0
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/GoTrueAdminApi.ts +32 -72
- package/src/GoTrueClient.ts +15 -0
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
package/src/GoTrueAdminApi.ts
CHANGED
|
@@ -65,14 +65,6 @@ export default class GoTrueAdminApi {
|
|
|
65
65
|
protected headers: {
|
|
66
66
|
[key: string]: string
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
private _encodePathSegment(segment: string): string {
|
|
70
|
-
if (segment === '.' || segment === '..') {
|
|
71
|
-
throw new AuthError('Invalid path segment')
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return encodeURIComponent(segment)
|
|
75
|
-
}
|
|
76
68
|
protected fetch: Fetch
|
|
77
69
|
protected experimental: ExperimentalFeatureFlags
|
|
78
70
|
|
|
@@ -990,18 +982,12 @@ export default class GoTrueAdminApi {
|
|
|
990
982
|
*/
|
|
991
983
|
private async _getOAuthClient(clientId: string): Promise<OAuthClientResponse> {
|
|
992
984
|
try {
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
headers: this.headers,
|
|
1000
|
-
xform: (client: any) => {
|
|
1001
|
-
return { data: client, error: null }
|
|
1002
|
-
},
|
|
1003
|
-
}
|
|
1004
|
-
)
|
|
985
|
+
return await _request(this.fetch, 'GET', `${this.url}/admin/oauth/clients/${clientId}`, {
|
|
986
|
+
headers: this.headers,
|
|
987
|
+
xform: (client: any) => {
|
|
988
|
+
return { data: client, error: null }
|
|
989
|
+
},
|
|
990
|
+
})
|
|
1005
991
|
} catch (error) {
|
|
1006
992
|
if (isAuthError(error)) {
|
|
1007
993
|
return { data: null, error }
|
|
@@ -1022,19 +1008,13 @@ export default class GoTrueAdminApi {
|
|
|
1022
1008
|
params: UpdateOAuthClientParams
|
|
1023
1009
|
): Promise<OAuthClientResponse> {
|
|
1024
1010
|
try {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
this.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
headers: this.headers,
|
|
1033
|
-
xform: (client: any) => {
|
|
1034
|
-
return { data: client, error: null }
|
|
1035
|
-
},
|
|
1036
|
-
}
|
|
1037
|
-
)
|
|
1011
|
+
return await _request(this.fetch, 'PUT', `${this.url}/admin/oauth/clients/${clientId}`, {
|
|
1012
|
+
body: params,
|
|
1013
|
+
headers: this.headers,
|
|
1014
|
+
xform: (client: any) => {
|
|
1015
|
+
return { data: client, error: null }
|
|
1016
|
+
},
|
|
1017
|
+
})
|
|
1038
1018
|
} catch (error) {
|
|
1039
1019
|
if (isAuthError(error)) {
|
|
1040
1020
|
return { data: null, error }
|
|
@@ -1054,8 +1034,7 @@ export default class GoTrueAdminApi {
|
|
|
1054
1034
|
clientId: string
|
|
1055
1035
|
): Promise<{ data: null; error: AuthError | null }> {
|
|
1056
1036
|
try {
|
|
1057
|
-
|
|
1058
|
-
await _request(this.fetch, 'DELETE', `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
1037
|
+
await _request(this.fetch, 'DELETE', `${this.url}/admin/oauth/clients/${clientId}`, {
|
|
1059
1038
|
headers: this.headers,
|
|
1060
1039
|
noResolveJson: true,
|
|
1061
1040
|
})
|
|
@@ -1077,11 +1056,10 @@ export default class GoTrueAdminApi {
|
|
|
1077
1056
|
*/
|
|
1078
1057
|
private async _regenerateOAuthClientSecret(clientId: string): Promise<OAuthClientResponse> {
|
|
1079
1058
|
try {
|
|
1080
|
-
const encodedClientId = this._encodePathSegment(clientId)
|
|
1081
1059
|
return await _request(
|
|
1082
1060
|
this.fetch,
|
|
1083
1061
|
'POST',
|
|
1084
|
-
`${this.url}/admin/oauth/clients/${
|
|
1062
|
+
`${this.url}/admin/oauth/clients/${clientId}/regenerate_secret`,
|
|
1085
1063
|
{
|
|
1086
1064
|
headers: this.headers,
|
|
1087
1065
|
xform: (client: any) => {
|
|
@@ -1163,18 +1141,12 @@ export default class GoTrueAdminApi {
|
|
|
1163
1141
|
*/
|
|
1164
1142
|
private async _getCustomProvider(identifier: string): Promise<CustomProviderResponse> {
|
|
1165
1143
|
try {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
headers: this.headers,
|
|
1173
|
-
xform: (provider: any) => {
|
|
1174
|
-
return { data: provider, error: null }
|
|
1175
|
-
},
|
|
1176
|
-
}
|
|
1177
|
-
)
|
|
1144
|
+
return await _request(this.fetch, 'GET', `${this.url}/admin/custom-providers/${identifier}`, {
|
|
1145
|
+
headers: this.headers,
|
|
1146
|
+
xform: (provider: any) => {
|
|
1147
|
+
return { data: provider, error: null }
|
|
1148
|
+
},
|
|
1149
|
+
})
|
|
1178
1150
|
} catch (error) {
|
|
1179
1151
|
if (isAuthError(error)) {
|
|
1180
1152
|
return { data: null, error }
|
|
@@ -1198,19 +1170,13 @@ export default class GoTrueAdminApi {
|
|
|
1198
1170
|
params: UpdateCustomProviderParams
|
|
1199
1171
|
): Promise<CustomProviderResponse> {
|
|
1200
1172
|
try {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
this.
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
headers: this.headers,
|
|
1209
|
-
xform: (provider: any) => {
|
|
1210
|
-
return { data: provider, error: null }
|
|
1211
|
-
},
|
|
1212
|
-
}
|
|
1213
|
-
)
|
|
1173
|
+
return await _request(this.fetch, 'PUT', `${this.url}/admin/custom-providers/${identifier}`, {
|
|
1174
|
+
body: params,
|
|
1175
|
+
headers: this.headers,
|
|
1176
|
+
xform: (provider: any) => {
|
|
1177
|
+
return { data: provider, error: null }
|
|
1178
|
+
},
|
|
1179
|
+
})
|
|
1214
1180
|
} catch (error) {
|
|
1215
1181
|
if (isAuthError(error)) {
|
|
1216
1182
|
return { data: null, error }
|
|
@@ -1228,16 +1194,10 @@ export default class GoTrueAdminApi {
|
|
|
1228
1194
|
identifier: string
|
|
1229
1195
|
): Promise<{ data: null; error: AuthError | null }> {
|
|
1230
1196
|
try {
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
`${this.url}/admin/custom-providers/${encodedIdentifier}`,
|
|
1236
|
-
{
|
|
1237
|
-
headers: this.headers,
|
|
1238
|
-
noResolveJson: true,
|
|
1239
|
-
}
|
|
1240
|
-
)
|
|
1197
|
+
await _request(this.fetch, 'DELETE', `${this.url}/admin/custom-providers/${identifier}`, {
|
|
1198
|
+
headers: this.headers,
|
|
1199
|
+
noResolveJson: true,
|
|
1200
|
+
})
|
|
1241
1201
|
return { data: null, error: null }
|
|
1242
1202
|
} catch (error) {
|
|
1243
1203
|
if (isAuthError(error)) {
|
package/src/GoTrueClient.ts
CHANGED
|
@@ -1116,6 +1116,21 @@ export default class GoTrueClient {
|
|
|
1116
1116
|
* password: 'some-password',
|
|
1117
1117
|
* })
|
|
1118
1118
|
* ```
|
|
1119
|
+
*
|
|
1120
|
+
* @exampleDescription Handling errors
|
|
1121
|
+
* Log the full `error` object so fields like `code`, `status`, and `name` aren't hidden. The `error.code` (e.g. `'invalid_credentials'`, `'email_not_confirmed'`) is often more useful for branching than `error.message`, and the full object surfaces both.
|
|
1122
|
+
*
|
|
1123
|
+
* @example Handling errors
|
|
1124
|
+
* ```js
|
|
1125
|
+
* const { data, error } = await supabase.auth.signInWithPassword({
|
|
1126
|
+
* email: 'example@email.com',
|
|
1127
|
+
* password: 'example-password',
|
|
1128
|
+
* })
|
|
1129
|
+
* if (error) {
|
|
1130
|
+
* console.error(error)
|
|
1131
|
+
* return
|
|
1132
|
+
* }
|
|
1133
|
+
* ```
|
|
1119
1134
|
*/
|
|
1120
1135
|
async signInWithPassword(
|
|
1121
1136
|
credentials: SignInWithPasswordCredentials
|
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.107.0-canary.
|
|
7
|
+
export const version = '2.107.0-canary.2'
|