Closed Nedimko123 closed 1 year ago
but in the app it only returns accessToken, and it doesnt ask me to login or anything else..
This is probably because you are already signed in. There might be a flag that you can pass to your OAuth provider to control what happens if a user is already logged in.
Unfortunately I cannot help you with that since it's outside of this library...
Okay, so the problem with it never asking me for login was due to the reason that I only had 1 account linked with google chrome on the phone, when I added another one, it prompted me.
But I still can't fix the error when it does return me json accessToken, the app just awaits for the login process to complete, maybe my url scheme is not right or something. When the login completes it redirects me here: https://goldfish-app-bd5g8.ondigitalocean.app/auth/google/redirect?code=4%2F0ARtbsJpAS0HI_FduXCxKvTlUyWUE1C86THxCpLeFfM700kGa35RfbbMAxO9O9PcVXTMCsg&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+openid&authuser=0&prompt=none The code is still the same:
const callbackUrlScheme =
'goldfish-app-bd5g8.ondigitalocean.app';
// Construct the url
final url = Uri.parse(
"https://goldfish-app-bd5g8.ondigitalocean.app/auth/google");
// Present the dialog to the user
try {
final result = await FlutterWebAuth.authenticate(
url: url.toString(),
preferEphemeral: false,
callbackUrlScheme: callbackUrlScheme);
print(result);
} catch (e) {
print(e);
}
Your callback url scheme is goldfish-app-bd5g8.ondigitalocean.app
, so you need to redirect to goldfish-app-bd5g8.ondigitalocean.app://...
-something, not https://goldfish-app-bd5g8.ondigitalocean.app/...
Please read the troubleshooting guide for more info 👍
Hello, I would appreciate your help greatly, thank you... This is my code: I commented out everything after FlutterWeb Auth.authenticate, because it just awaits it for me to finish.
We used this as an api https://goldfish-app-bd5g8.ondigitalocean.app/api#, and this is how I would login via google to our rest api: https://goldfish-app-bd5g8.ondigitalocean.app/auth/google .. but in the app it only returns accessToken, and it doesnt ask me to login or anything else..