![](/img/trans.png)
[英]How to get uid of currentUser after sign up in flutter firebase
[英]How to sign up and in with OAuth credentials in firebase and flutter?
I was reading in the firebase Auth Rest Api and found this OAuth Credentials that contains a lot of information about a user that signs in including if the email is verified, So I tried to do it in my flutter app but looks like I am missing sth称为请求 URI 我是 flutter 和 firebase 的新手,所以我需要你的帮助。
我的代码:
static Future signin(String email, String password) async {
try {
http.Response response = await http.post(
'https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=AIzaSyD3KOx9KSfK1lhyWRCt4_-dXLkKDNq-0hU',
body: {
'email': email,
'password': password,
'requestUri': ?? 'Sth of Type String',
},
);
if (response.statusCode == 200) {
print(response.statusCode);
print(json.decode(response.body));
} else {
print(response.statusCode);
}
String jsonsDataString = response.body.toString();
var _data = jsonDecode(jsonsDataString);
print(_data.toString());
print({email, password});
if (response.body.contains('EMAIL_EXISTS')) {
print('email exists');
} else if (response.body.contains('WEAK_PASSWORD')) {
print('weak password');
}
} catch (e) {
print(e);
}
}
您正在使用 API 通过 oAuth 登录,并且 requestUri 是身份验证流的重定向 URL。 检查此链接: https://www.oauth.com/oauth2-servers/redirect-uris/
您可以做的是使用 email api 登录。 检查https://firebase.google.com/docs/reference/rest/auth并使用 email / 密码搜索登录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.