@zodic/shared 0.0.128 → 0.0.129
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/package.json +1 -1
- package/types/scopes/generic.ts +1 -2
- package/utils/index.ts +16 -1
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, JWKS } from '../types';
|
|
2
|
+
import { AuthCtx, JWKS, Provider, ProviderInfo } from '../types';
|
|
3
3
|
|
|
4
4
|
const base64UrlDecode = (input: string) => {
|
|
5
5
|
const base64 = input.replace(/-/g, '+').replace(/_/g, '/');
|
|
@@ -101,6 +101,21 @@ export const verifyToken = async (
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
+
export const providers: (c: AuthCtx) => Record<Provider, ProviderInfo> = () => ({
|
|
105
|
+
google: {
|
|
106
|
+
serverUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
107
|
+
clientId: process.env.GOOGLE_OAUTH_CLIENT_ID!,
|
|
108
|
+
clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET!,
|
|
109
|
+
resourceUrl: 'https://www.googleapis.com/oauth2/v2/userinfo',
|
|
110
|
+
},
|
|
111
|
+
facebook: {
|
|
112
|
+
serverUrl: 'https://www.facebook.com/v13.0/dialog/oauth',
|
|
113
|
+
clientId: process.env.FACEBOOK_OAUTH_CLIENT_ID!,
|
|
114
|
+
clientSecret: process.env.FACEBOOK_OAUTH_CLIENT_SECRET!,
|
|
115
|
+
resourceUrl: 'https://graph.facebook.com/me?fields=id,name,email,picture',
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
104
119
|
export function normalizeName(name: string): string {
|
|
105
120
|
return name.toLowerCase().replace(/\s+/g, '-');
|
|
106
121
|
}
|