我的 Google 登录有问题,我目前正在使用 EXPO 应用程序,我希望不惜一切代价不要弹出/选择退出 Expo,问题是当我单击按钮在我的应用程序中使用 Google 登录时,它确实会带我进入浏览器内的登录页面,但一旦我输入我的 Google 凭据,它就会进入 Google.com 页面。
我检查了很多帖子,但仍然无法让它返回到应用程序。
我的应用程序登录代码是:
//import de Google en Expo
import * as Google from 'expo-google-app-auth';
import * as AppAuth from 'expo-app-auth';
export const googleLogin = () => {
console.log('***Entro en Google***');
return async dispatch => {
try {
const result = await Google.logInAsync({
androidClientId: '***my ID Censored***',
scopes: ['profile', 'email'],
behavior: 'web',
redirectUrl: `${AppAuth.OAuthRedirect}:/oauthredirect`
});
console.log('***Hizo Consulta***');
if (result.type === 'success') {
console.log(result.accessToken);
} else {
return { …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,其中用户应该仅由管理员用户创建,问题是,当在 Firebase 中创建新用户时,应用程序使用新用户信息登录,因此原始登录用户(管理员用户)必须登录退出,然后重新登录以创建新用户。
这是我创建新用户的功能:
void createUser(
String email,
String password,
String nombre,
String dui,
DateTime fechaNacimiento,
String telefono,
String nombreContacto,
String telefonoContacto,
DateTime fechaIngreso,
String radio,
File foto,
String acceso,
) async {
try {
final auth = FirebaseAuth.instance;
UserCredential authResult = await auth.createUserWithEmailAndPassword(
email: email,
password: password,
);
//var uploadUid = authResult.user?.uid;
final ref = FirebaseStorage.instance
.ref()
.child('user_images')
.child(authResult.user!.uid + '.jpg');
await ref.putFile(foto);
final url = await ref.getDownloadURL();
await FirebaseFirestore.instance
.collection('users')
.doc(authResult.user!.uid)
.set({
'nombre': nombre,
'dui': dui,
'fechaNacimiento': fechaNacimiento, …Run Code Online (Sandbox Code Playgroud) 我想创建一个云函数,当在 Firestore 中删除对象(列表)时,它会自动删除 FirebaseStorage 中关联的图像。
作为上下文,当创建列表时,我们采用该文档 ID 并将其设置为 FirebaseStorage 中的子文件夹的名称。
像这样:
所以基本上我在文件夹调用 ListingImages 中有主存储桶,并且在每个列表(Firestore 中的文档)内部有一个文件夹。
所以我的最终目标是,当我在 Firestore 中删除具有该 ID 的文档时,它会删除 Firebase 存储中的文件夹及其所有内容。
目前,我有这个云功能代码,但它不起作用:
// Function que elimina imagenes de un Listing cuando es borrado de Firebase.
exports.listingImagesDelete = functions.firestore.document("listings/{listingId}").onDelete((snapshot, context) => {
const listingId = snapshot.id;
const filePath = "ListingImages/" + listingId + "/";
const defaultBucket = admin.storage().bucket();
const file = defaultBucket.file(filePath);
const pr = file.delete();
return pr;
});
Run Code Online (Sandbox Code Playgroud)
但是当我运行它(从 Firestore 中删除列表)时,它给了我这个错误:
虽然有一个文件夹,但看起来好像没有对象。
关于如何完成这项任务有什么想法吗?
node.js google-cloud-storage firebase google-cloud-functions google-cloud-firestore