Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How generate right credentials for Google Sign-in? #108

Closed
hmarat opened this issue May 10, 2022 · 30 comments
Closed

How generate right credentials for Google Sign-in? #108

hmarat opened this issue May 10, 2022 · 30 comments

Comments

@hmarat
Copy link

hmarat commented May 10, 2022

In my flutter project which is for both Android and iOS, I want to implement authentication with Google. Supabase wants from me the Client ID and Client secret. When I go to the Google Cloud Platform and try to generate an OAuth Client ID, it asks from me the project type(Web, Android, iOS).

  1. What type should I select, if my project is for both Android and iOS, but Supabase asks from me only one Client ID and Client secret.
  2. For example if I select Android, it gives me only Client ID, not client secret, but Supabase waits from me both.
  3. Then I selected web application, and filled the client id and client secret fields in Supabase google sign in credentials. But when I try to sign in with Provider.Google in supabase, it in the same moment returns null data.

p.s. Even consent screen is not opening

@hmarat
Copy link
Author

hmarat commented May 10, 2022

@bdlukaa
Copy link
Collaborator

bdlukaa commented May 11, 2022

supabase/gotrue-dart#68 (comment) may be related

@dshukertjr
Copy link
Member

@hmarat At the moment, Supabase supports web based OAuth login. The PR @bdlukaa has mentioned is one that brings Supabase closer to adding a fully native OAuth login, but there are some works to be done so it will take a little more time for it to land.

In the mean while, you mentioned that you are not able to sign in even using the web version. Are you using the signInWithProvider() method to sign in?

@hmarat
Copy link
Author

hmarat commented May 11, 2022

@dshukertjr I didn't try web, I need only mobile for now :) So I can't use native google sign in with normal consent screen for now? When it will be implemented and available?

@dshukertjr
Copy link
Member

@hmarat

I didn't try web, I need only mobile for now

Sorry, I wasn't clear enough. It does work on mobile app, but it will take users to the web version of the consent screen, which might not be ideal for some situations. Give signInWithProvider() a try and you will see it!

So I can't use native google sign in with normal consent screen for now? When it will be implemented and available?

Hopefully not so far away from now, but we do not have a definite timeline on this.

@hmarat
Copy link
Author

hmarat commented May 11, 2022

@dshukertjr okay, thanks :) What about getting access token on frontend and write some cloud function on Supabase?)And then send it from frontend to the supabase, and with just rest api, get all google user data for sign in?

@dshukertjr
Copy link
Member

@hmarat If your goal is to obtain user's Google profile information and not sign users in via Google account, then I think that will work!

@hmarat
Copy link
Author

hmarat commented May 12, 2022

My goal here is Sign in user with google. Can I get user's data with cloud function and just create new user or generate some token if user already exists?

@dshukertjr
Copy link
Member

@hmarat If you are trying to sign users in via their Google account, then the method I provided here will be the best option, but have you tried it?

Sorry, I wasn't clear enough. It does work on mobile app, but it will take users to the web version of the consent screen, which might not be ideal for some situations. Give signInWithProvider() a try and you will see it!

With the cloud functions route, you might be able to get user information, but you won't be able to sign the user in via our auth system unfortunately.

@hmarat
Copy link
Author

hmarat commented May 12, 2022

Okay @dshukertjr , thanks. I will try it and let you know ;)

@hmarat
Copy link
Author

hmarat commented May 12, 2022

@dshukertjr and if I do in the way you told, what is your suggestion about redirecting back to the app with already signed in user?😀

@dshukertjr
Copy link
Member

@hmarat You can use deeplinks to bring the users back to the app.

@avalanche-tm
Copy link

avalanche-tm commented May 15, 2022

@hmarat

I didn't try web, I need only mobile for now

Sorry, I wasn't clear enough. It does work on mobile app, but it will take users to the web version of the consent screen, which might not be ideal for some situations. Give signInWithProvider() a try and you will see it!

So I can't use native google sign in with normal consent screen for now? When it will be implemented and available?

Hopefully not so far away from now, but we do not have a definite timeline on this.

I'm getting a similar issue when trying to login with Google locally. Since only web version is working, I cannot enter my local android simulator address (http://10.0.2.2:54321/auth/v1/callback) as authorized redirect uri when creating Google web credentials in Google Cloud console. I get: 'Invalid Redirect: must end with a public top-level domain (such as .com or .org).'

How do I get around that? I'd like to do testing in my local supabase running in docker.

PS: I tried putting url of my online instance but then I get this:
image

@hmarat
Copy link
Author

hmarat commented Jun 1, 2022

@hmarat You can use deeplinks to bring the users back to the app.

I tried this, it can work, yes, but it's very uncomfortable, because asks from user open the link in app or continue with browser :(
Any other comfortable ways to do this?

@hmarat
Copy link
Author

hmarat commented Jun 2, 2022

@dshukertjr If I will go firebase, will I be able to migrate all data into supabase in the upcoming future, if authentication will be fully implemented for mobile?

@dshukertjr
Copy link
Member

I tried this, it can work, yes, but it's very uncomfortable, because asks from user open the link in app or continue with browser :(
Any other comfortable ways to do this?

We are right around the corner at implementing native auth, which is what you are looking for it seems like!

If I will go firebase, will I be able to migrate all data into supabase in the upcoming future, if authentication will be fully implemented for mobile?

Yup, we have Firebase to Supabase migration tool here.

@hmarat
Copy link
Author

hmarat commented Jun 2, 2022

@dshukertjr Amazing, thanks!

@dshukertjr
Copy link
Member

@hmarat I will go ahead and close this issue. You can follow the progress on proper mobile auth flow here!

@hmarat
Copy link
Author

hmarat commented Jun 12, 2022

@dshukertjr any news? :)

@dshukertjr
Copy link
Member

@hmarat Sorry, not quite yet. We will deliver the news once it has been implemented!

@hmarat
Copy link
Author

hmarat commented Jun 18, 2022

@dshukertjr Okay, so what do you suggest ? :) I should release the app in july.

  1. Implement it with firebase and then later migrate to supabase.
  2. Wait for native auth and implement it with supabase.
    Thanks )

@dshukertjr
Copy link
Member

@hmarat If I were you, I would just go with Supabase now and build the social login with the current implementation. Currently, you can still sign people in using Google account from your native app by redirecting the users to the browser only for signing in. You can follow the example here on how you can do that. Eventually when true native sign in lands on Supabase, I would upgrade the supabase-flutter plugin to start using that.

If you can release your app with just email + password auth to begin with, that might be a good option as well.

If for some reason true native sign in is an absolute requirement, and you absolutely must release your app by July, then I would initially go with Firebase to play it safe.

@hmarat
Copy link
Author

hmarat commented Jun 19, 2022

@dshukertjr Okay, thank you for the answer :) And lastly can you tell me the approximate time, when this will be ready ? :)

@dshukertjr
Copy link
Member

@hmarat We are really hoping to get it shipped by August!

@hmarat
Copy link
Author

hmarat commented Jul 15, 2022

@hmarat We are really hoping to get it shipped by August!

Hey @dshukertjr :) We decided to wait your Auth implementation :) Do you think it will be done by August?

@dshukertjr
Copy link
Member

Hey @hmarat,

We are working hard, but the auth team of Supabase have a lot on their plates, so cannot promise anything for sure. With that being said, native auth is a very demanded feature, so we would love to bring it ASAP.

BTW, what is the auth provider that you plan to use? Maybe we can prioritize those ones.

@fabios9702
Copy link

I'm looking forward to this feature too, hoping to have this ASAP. I'm planning to use google and apple

@hmarat
Copy link
Author

hmarat commented Jul 16, 2022

Hey @hmarat,

We are working hard, but the auth team of Supabase have a lot on their plates, so cannot promise anything for sure. With that being said, native auth is a very demanded feature, so we would love to bring it ASAP.

BTW, what is the auth provider that you plan to use? Maybe we can prioritize those ones.

Google and Apple :) Thanks. Will be very happy to see it implemented :)

@hmarat
Copy link
Author

hmarat commented Aug 3, 2022

@dshukertjr any news about the progress? :)

@dshukertjr
Copy link
Member

There will be updates posted on this issue #5 when there is one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants