-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Monilprajapati/main
Done with Google Auth Login and Register
- Loading branch information
Showing
18 changed files
with
11,240 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
VITE_CLIENT_ID=githubclientid | ||
VITE_URL=http://localhost:3001 | ||
|
||
# Firebase environment variables | ||
|
||
VITE_FIREBASE_API_KEY= | ||
VITE_FIREBASE_AUTH_DOMAIN= | ||
VITE_FIREBASE_PROJECT_ID= | ||
VITE_FIREBASE_STORAGE_BUCKET= | ||
VITE_FIREBASE_MESSAGING_SENDER_ID= | ||
VITE_FIREBASE_APP_ID= | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { initializeApp } from "firebase/app"; | ||
import { GoogleAuthProvider,signInWithPopup,getAuth } from "firebase/auth"; | ||
|
||
const firebaseConfig = { | ||
apiKey: import.meta.env.VITE_FIREBASE_API_KEY, | ||
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN, | ||
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID, | ||
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET, | ||
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID, | ||
appId: import.meta.env.VITE_FIREBASE_APP_ID, | ||
}; | ||
|
||
const app = initializeApp(firebaseConfig); | ||
|
||
const provider = new GoogleAuthProvider(); | ||
|
||
const auth = getAuth(); | ||
|
||
const authWithGoogle = async () => { | ||
try { | ||
const result = await signInWithPopup(auth, provider); | ||
const user = result.user; | ||
console.log(user) | ||
return user | ||
} catch (error) { | ||
console.log(error); | ||
return err | ||
} | ||
}; | ||
|
||
export { authWithGoogle }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
MONGODB_URI=mongodb://127.0.0.1:27017/blackmarket | ||
JWT_SECRET=jwt_secret | ||
CLIENT_ID=github_client_id | ||
CLIENT_SECRET=github_secret | ||
CLIENT_SECRET=github_secret | ||
|
||
# Firebase environment variables | ||
|
||
TYPE= | ||
PROJECT_ID= | ||
PRIVATE_KEY_ID= | ||
PRIVATE_KEY= | ||
FIREBASE_CLIENT_EMAIL= | ||
FIREBASE_CLIENT_ID= | ||
AUTH_URI= | ||
TOKEN_URI= | ||
AUTH_PROVIDER_X509_CERT_URL= | ||
CLIENT_X509_CERT_URL= | ||
UNIVERSE_DOMAIN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const serviceAccountKey = { | ||
type: process.env.TYPE, | ||
project_id: process.env.PROJECT_ID, | ||
private_key_id: process.env.PRIVATE_KEY_ID, | ||
private_key: process.env.PRIVATE_KEY, | ||
client_email: process.env.FIREBASE_CLIENT_EMAIL, | ||
client_id: process.env.FIREBASE_CLIENT_ID, | ||
auth_uri: process.env.AUTH_URI, | ||
token_uri: process.env.TOKEN_URI, | ||
auth_provider_x509_cert_url: process.env.AUTH_PROVIDER_X509_CERT_URL, | ||
client_x509_cert_url: process.env.CLIENT_X509_CERT_URL, | ||
universe_domain: process.env.UNIVERSE_DOMAIN, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.