@zodic/shared 0.0.95 → 0.0.97
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/db/schema.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
real,
|
|
6
6
|
sqliteTable,
|
|
7
7
|
text,
|
|
8
|
+
unique,
|
|
8
9
|
} from 'drizzle-orm/sqlite-core';
|
|
9
10
|
|
|
10
11
|
export const timestampFields = {
|
|
@@ -58,10 +59,13 @@ export const usersTemp = sqliteTable(
|
|
|
58
59
|
name: text('name').notNull(),
|
|
59
60
|
profileImage: text('profile_image'),
|
|
60
61
|
oauthProvider: text('oauth_provider'), // e.g., "google", "facebook", "apple", nullable for password-based login
|
|
61
|
-
oauthProviderId: text('oauth_provider_id')
|
|
62
|
+
oauthProviderId: text('oauth_provider_id'), // Remove .unique()
|
|
62
63
|
...timestampFields,
|
|
63
64
|
},
|
|
64
|
-
(t) => [
|
|
65
|
+
(t) => [
|
|
66
|
+
index('users_temp_email_idx').on(t.email),
|
|
67
|
+
unique().on(t.oauthProvider, t.oauthProviderId),
|
|
68
|
+
]
|
|
65
69
|
);
|
|
66
70
|
|
|
67
71
|
export const creditsTransactions = sqliteTable(
|
package/package.json
CHANGED
package/types/scopes/generic.ts
CHANGED
package/utils/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jwtVerify } from 'jose';
|
|
2
|
-
import { AuthCtx, Gender,
|
|
2
|
+
import { AuthCtx, Gender, VALID_GENDERS_ARRAY } from '../types';
|
|
3
3
|
|
|
4
4
|
export const verifyToken = async (
|
|
5
5
|
c: AuthCtx,
|
|
@@ -32,20 +32,18 @@ export const verifyToken = async (
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export const providers
|
|
36
|
-
c
|
|
37
|
-
) => ({
|
|
35
|
+
export const providers = (c: AuthCtx) => ({
|
|
38
36
|
google: {
|
|
39
|
-
serverUrl:
|
|
40
|
-
clientId: c.env.
|
|
41
|
-
clientSecret: c.env.
|
|
42
|
-
resourceUrl: '',
|
|
37
|
+
serverUrl: 'https://accounts.google.com',
|
|
38
|
+
clientId: c.env.GOOGLE_OAUTH_CLIENT_ID,
|
|
39
|
+
clientSecret: c.env.GOOGLE_OAUTH_CLIENT_SECRET,
|
|
40
|
+
resourceUrl: 'https://www.googleapis.com/oauth2/v2/userinfo',
|
|
43
41
|
},
|
|
44
42
|
facebook: {
|
|
45
|
-
serverUrl:
|
|
46
|
-
clientId: c.env.
|
|
47
|
-
clientSecret: c.env.
|
|
48
|
-
resourceUrl: '',
|
|
43
|
+
serverUrl: 'https://www.facebook.com/v11.0/dialog/oauth',
|
|
44
|
+
clientId: c.env.FACEBOOK_OAUTH_CLIENT_ID,
|
|
45
|
+
clientSecret: c.env.FACEBOOK_OAUTH_CLIENT_SECRET,
|
|
46
|
+
resourceUrl: 'https://graph.facebook.com/me?fields=id,name,email,picture',
|
|
49
47
|
},
|
|
50
48
|
});
|
|
51
49
|
|