sanjaya1996 / proShop-EcommerceWebApp

Ecommerce web application Project ( using MERN Stack)
7 stars 5 forks source link

I couldn't implement Google Sign In. #2

Open talmax1124 opened 3 years ago

talmax1124 commented 3 years ago

Can you create a PR to my repo. I have way too many errors with your code. I have followed the tutorial and couldn't do it.

Here is my repo: https://github.com/Obsession-Boutique

sanjaya1996 commented 3 years ago

Sure man, I will have a look, just give me some time. Do not worry, I will make it work.

On Thu, 29 Apr 2021 at 5:28 am, Carlos @.***> wrote:

Can you create a PR to my repo. I have way too many errors with your code. I have followed the tutorial and couldn't do it.

Here is my repo: https://github.com/Obsession-Boutique

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW6SS5ODU5PTZEE6QYLTLBOXXANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Thanks! Hope you have a great day!

talmax1124 commented 3 years ago

Is there a way to implement facebook sign in?

talmax1124 commented 3 years ago

Do you know when the PR is going to be ready @sanjaya1996

talmax1124 commented 3 years ago

Howdy! Just seeing if you could implement the google sign in

sanjaya1996 commented 3 years ago

Hi Carlos, I became quite busy this week. I will definitely have a look this weekend and get back to you. Sorry for the delay. Cheers

On Wed, 5 May 2021 at 9:15 pm, Carlos @.***> wrote:

Howdy! Just seeing if you could implement the google sign in

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-832607008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW7KRFKSCBDC5MHW2I3TMESDPANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Hi Carlos, I became quite busy this week. I will definitely have a look this weekend and get back to you. Sorry for the delay. Cheers

On Wed, 5 May 2021 at 9:15 pm, Carlos @.***> wrote:

Howdy! Just seeing if you could implement the google sign in

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-832607008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW7KRFKSCBDC5MHW2I3TMESDPANCNFSM43XWJUKA .

Ok, thanks! Do you know how to implement facebook sign in?

sanjaya1996 commented 3 years ago

Yes, Facebook / google SignIn , both are pretty similar to implement. Can you please provide your .env variables at the meantime. I will clone your project this weekend and provide you a solution. Cheers

On Thu, May 6, 2021 at 7:18 PM Carlos @.***> wrote:

Hi Carlos, I became quite busy this week. I will definitely have a look this weekend and get back to you. Sorry for the delay. Cheers

On Wed, 5 May 2021 at 9:15 pm, Carlos @.***> wrote:

Howdy! Just seeing if you could implement the google sign in

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub

2 (comment)

https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-832607008 , or unsubscribe

https://github.com/notifications/unsubscribe-auth/ANXTXW7KRFKSCBDC5MHW2I3TMESDPANCNFSM43XWJUKA .

Ok, thanks! Do you know how to implement facebook sign in?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-833372068, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW2OGRM7INO2UXXZDQLTMJNG5ANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Which ones do you need?

sanjaya1996 commented 3 years ago

I am not asking for the credentials, just variable names. And can you please confirm your repo, there are two repo, one Next.js and another Mern project in the link that you provided.

On Thu, May 6, 2021 at 8:48 PM Carlos @.***> wrote:

Which ones do you need?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-833427344, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXWYI4A34MAFZ4533UQTTMJXX5ANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Oh ok. Here is the repo: https://github.com/Obsession-Boutique/Joannie-Store-Shop

talmax1124 commented 3 years ago

ENV Names:

NODE_ENV = development PORT = 5000 MONGO_URI = JWT_SECRET = 'abc123' PAYPAL_CLIENT_ID = REACT_EDITOR = atom

CLOUDINARY_CLOUD_NAME = CLOUDINARY_API_KEY = CLOUDINARY_API_SECRET =

talmax1124 commented 3 years ago

This is all the env variables @sanjaya1996

talmax1124 commented 3 years ago

& thank you for helping me out. @sanjaya1996

talmax1124 commented 3 years ago

Hey, do you think you can help implement something real quick.

I've been trying to implement multi-image support on the productscreen.

Most people tell me to convert it to an array but i don't know how to do that. I just want to show a gallery in the product screen and a single image in the home screen. Could you help me integrate it?


& if you have the time, i want to have a dropdown in the product screen where user can select the size, already set in code in the product screen. & have something in product edit to hide those options

Thanks! @sanjaya1996

sanjaya1996 commented 3 years ago

Hey Mate Completed Endpoint setup for your google sign-in. Working like a charm. Want to test it? Should I make a pull request or make it after implementing everything? Consider these additional .env variables in your app: API_URI=http://localhost:5000 for development and your domain name for production ORIGIN_URI=http://localhost:3000 for development and your domain name for production if your server and client are running in same domain SESSION_SECRET= lkjkljdso897bdksjf Can be anything GOOGLE_CLIENT_ID= Get from google developer console GOOGLE_CLIENT_SECRET= Get from google developer console

On Fri, May 7, 2021 at 8:18 PM Carlos @.***> wrote:

Hey, do you think you can help implement something real quick.

I've been trying to implement multi-image support on the productscreen.

Most people tell me to convert it to an array but i don't know how to do that. I just want to show a gallery in the product screen and a single image in the home screen. Could you help me integrate it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-834241613, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW7GDX3I6MZRQNGFDALTMO45XANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

How do I test it, & yes, please do a pull request if you can

On Sat, May 8, 2021 at 11:24 PM Sanzay Dahal @.***> wrote:

Hey Mate Completed Endpoint setup for your google sign-in. Working like a charm. Want to test it? Should I make a pull request or make it after implementing everything? Consider these additional .env variables in your app: API_URI=http://localhost:5000 for development and your domain name for production ORIGIN_URI=http://localhost:3000 for development and your domain name for production if your server and client are running in same domain SESSION_SECRET= lkjkljdso897bdksjf Can be anything GOOGLE_CLIENT_ID= Get from google developer console GOOGLE_CLIENT_SECRET= Get from google developer console

On Fri, May 7, 2021 at 8:18 PM Carlos @.***> wrote:

Hey, do you think you can help implement something real quick.

I've been trying to implement multi-image support on the productscreen.

Most people tell me to convert it to an array but i don't know how to do that. I just want to show a gallery in the product screen and a single image in the home screen. Could you help me integrate it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-834241613 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ANXTXW7GDX3I6MZRQNGFDALTMO45XANCNFSM43XWJUKA

.

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835654042, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVNS3VVPDQUISNJRXA3DI3TMX6ANANCNFSM43XWJUKA .

sanjaya1996 commented 3 years ago

I will head into the client side shortly. You can test the backend by visiting http:localhost:5000/api/auth/google

On Sun, May 9, 2021 at 1:24 PM Sanzay Dahal @.***> wrote:

Hey Mate Completed Endpoint setup for your google sign-in. Working like a charm. Want to test it? Should I make a pull request or make it after implementing everything? Consider these additional .env variables in your app: API_URI=http://localhost:5000 for development and your domain name for production ORIGIN_URI=http://localhost:3000 for development and your domain name for production if your server and client are running in same domain SESSION_SECRET= lkjkljdso897bdksjf Can be anything GOOGLE_CLIENT_ID= Get from google developer console GOOGLE_CLIENT_SECRET= Get from google developer console

On Fri, May 7, 2021 at 8:18 PM Carlos @.***> wrote:

Hey, do you think you can help implement something real quick.

I've been trying to implement multi-image support on the productscreen.

Most people tell me to convert it to an array but i don't know how to do that. I just want to show a gallery in the product screen and a single image in the home screen. Could you help me integrate it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-834241613, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW7GDX3I6MZRQNGFDALTMO45XANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Ok, perfect. did you by any chance had to add any scopes? Did you have to wait for verification? @sanjaya1996

When I did it, It said I could only do it for development because of the scopes. So that's why I am asking.

sanjaya1996 commented 3 years ago

Hi please ignore the lines in file changed due to the change of double quotes to single quotes. It is because of my VS code setting where I have single quotes set to default instead of double quotes. Therefore you are seeing more changes in commit. Cheers

On Fri, May 7, 2021 at 8:18 PM Carlos @.***> wrote:

Hey, do you think you can help implement something real quick.

I've been trying to implement multi-image support on the productscreen.

Most people tell me to convert it to an array but i don't know how to do that. I just want to show a gallery in the product screen and a single image in the home screen. Could you help me integrate it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-834241613, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW7GDX3I6MZRQNGFDALTMO45XANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

I don't see any pull request, could you send a pull request? @sanjaya1996

sanjaya1996 commented 3 years ago

I can clearly see in your repo. 1 pull request Complete endpoint setup for google signin with passportjs https://github.com/Obsession-Boutique/Joannie-Store-Shop/pull/6

On Sun, May 9, 2021 at 1:55 PM Carlos @.***> wrote:

I don't see any pull request

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835663029, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW4W6HT6SVQGVO57WO3TMYBRXANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Ok, Now I see it!

talmax1124 commented 3 years ago

Did you have any scopes? Any specific settings in the google cloud console thing? @sanjaya1996

sanjaya1996 commented 3 years ago

You don’t need to setup scopes in google console. Just get client ID, secret and put redirect URL exact same as you have in your code.

On Sun, 9 May 2021 at 2:09 pm, Carlos @.***> wrote:

Did you have any scopes? Any specific settings in the google cloud console thing?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835667416, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW3OSEVLLHKCMKLPACLTMYDIDANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

I have this error: secret option required for sessions. Nevermind, I forgot to restart the server after changing the .env.

talmax1124 commented 3 years ago

Is there supposed to be a google sign in button in the login screen? Was that part of your pull request?

talmax1124 commented 3 years ago
Screen Shot 2021-05-09 at 12 21 46 AM Screen Shot 2021-05-09 at 12 23 04 AM

Does this look good? @sanjaya1996

sanjaya1996 commented 3 years ago

No, I already told you that is just an server setup to handle google sign in request and I am heading soon towards client side for buttons and other stuffs.

On Sun, 9 May 2021 at 2:19 pm, Carlos @.***> wrote:

Is there supposed to be a google sign in button in the login screen? Was that part of your pull request?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835670462, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW3JBZYHMONOTTWDSNDTMYELVANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Oh, I am sorry, I did not understand you

sanjaya1996 commented 3 years ago

You need to create two different credentials, one for development and another for production. Origin uri will be your client localhost 3000 in development. Your heroku app is only for production

On Sun, 9 May 2021 at 2:27 pm, Carlos @.***> wrote:

Oh, I am sorry, I did not understand you

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835673289, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXWZXL4ZBICQHVWNRFADTMYFMPANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Yes, I fixed it. I can't add localhost to the authorized domain. Do I need to have localhost on it or is it fine?

sanjaya1996 commented 3 years ago

No need to add that. Keep it empty.

On Sun, 9 May 2021 at 2:37 pm, Carlos @.***> wrote:

Yes, I fixed it. I can't add localhost to the authorized domain. Do I need to have localhost on it or is it fine?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835676161, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW5RNX6XEO2J3YUPGHDTMYGQBANCNFSM43XWJUKA .

sanjaya1996 commented 3 years ago

You need it only for production

On Sun, 9 May 2021 at 2:38 pm, Sanzay Dahal @.***> wrote:

No need to add that. Keep it empty.

On Sun, 9 May 2021 at 2:37 pm, Carlos @.***> wrote:

Yes, I fixed it. I can't add localhost to the authorized domain. Do I need to have localhost on it or is it fine?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835676161, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW5RNX6XEO2J3YUPGHDTMYGQBANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Oh ok. Thanks. When you mean credentials, you mean google sign in accounts correct?

sanjaya1996 commented 3 years ago

No, Only Oauth Client ID’s

On Sun, 9 May 2021 at 2:39 pm, Carlos @.***> wrote:

Oh ok. Thanks. When you mean credentials, you mean google sign in accounts correct?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835676732, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXWYCQSBJJSXD6MOELL3TMYGYBANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

I haven't done this google thing before, so I'm confused.

Do you mean this?

Screen Shot 2021-05-09 at 12 46 10 AM
sanjaya1996 commented 3 years ago

Google developer console >> Choose your project or create a new One, Eg. myNewProject >> Go to API and Services >> Credentials >> Create Credentials ( create two 1 for development and another for production) >> Add all details like Origin Uri / javaScript Origin / redirect Url >> Copy Cliend Id and Client Secret >> Put in your .env file Or, watch tutorials on youtube

On Sun, 9 May 2021 at 2:46 pm, Carlos @.***> wrote:

I haven't done this google thing before, so I'm confused.

Do you mean this? [image: Screen Shot 2021-05-09 at 12 46 10 AM] https://user-images.githubusercontent.com/61528430/117560901-f42e7880-b05f-11eb-91a4-d70483fedb58.png

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835678673, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW7AHVRD3LBDOCDWMLDTMYHSVANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

Oh you mean this: OAuth 2.0 Client IDs

talmax1124 commented 3 years ago

Ok, I created another one

sanjaya1996 commented 3 years ago

First focus on development why you need to create production? Test the development first you do not need that for testing.

On Sun, May 9, 2021 at 3:04 PM Carlos @.***> wrote:

I already have one created. Let me create another one then

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835684141, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW5SYEKVXHXFDHYHHQTTMYJVTANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

I put the development variables in vscode already. & did the data:import to add it to backend

talmax1124 commented 3 years ago

When you make the next pull request, can you respond here to say you pushed it? I don't get pull requests email notification, so that's why I said I didn't see it before. @sanjaya1996

talmax1124 commented 3 years ago

When will the second PR be ready by?

sanjaya1996 commented 3 years ago

Hi mate Pull request has been made. Everything is working out of the box. You can merge the request. Hope it was helpful. Make sure to give some stars on my repos. Cheers

On Sun, May 9, 2021 at 4:05 PM Carlos @.***> wrote:

When will the second PR be ready by?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835702512, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW5RRZELAJ5GEZG3JXLTMYQ2HANCNFSM43XWJUKA .

talmax1124 commented 3 years ago

I most certaintly will!

Tried, and gave me this:

The redirect URI in the request, http://localhost:5000/api/auth/google/callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/301299659563-iselq9ap1jpsg24s8u8uvaj8f3k2cenc.apps.googleusercontent.com?project=301299659563

talmax1124 commented 3 years ago

My Config:

Screen Shot 2021-05-09 at 3 18 26 AM
sanjaya1996 commented 3 years ago

Brother, first try to investigate yourself it is a simple error. It is clearly stated in error message: The redirect URI in the request, http://localhost:5000/api/auth/google/callback, does not match the ones authorized for the OAuth client. /callback is missing in your Google redirect Urls.

Additionally, you do not need localhost:3000 in redirect Urls at any point.

talmax1124 commented 3 years ago

Ok, I just looked at the terminal in my editor, and it says that the error is due to the password being required. If I remove password required from the database, will there be any flaws in the security of the website?

sanjaya1996 commented 3 years ago

Remove {required: true} options of password field from your User Schema. It will not create any flaws.

On Sun, 9 May 2021 at 5:32 pm, Carlos @.***> wrote:

Ok, I just looked at the terminal in my editor, and it says that the error is due to the password being required. If I remove password required from the database, will there be any flaws in the security of the website?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sanjaya1996/proShop-EcommerceWebApp/issues/2#issuecomment-835727022, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXTXW5QGJUA5A43J2OEIEDTMY3BXANCNFSM43XWJUKA .