Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

[firebase auth/admin-restricted-operation] This operation is restricted to administrators only. #358

Closed
adelabdelstar opened this issue Nov 25, 2020 · 1 comment

Comments

@adelabdelstar
Copy link

import 'package:firebase_auth/firebase_auth.dart';

class AuthService {
//final FirebaseAuth _auth = FirebaseAuth.instance;

Future signInAnon() async {
try {
// UserCredential result = await _auth.signInAnonymously();
UserCredential result = await FirebaseAuth.instance.signInAnonymously();
User user = result.user;
return user;
} catch (e) {
print(e.toString());
return null;
}
}
}

import 'package:flutter/material.dart';
import 'package:newfirebase/services/auth.dart';

class SignIn extends StatefulWidget {
@OverRide
_SignInState createState() => _SignInState();
}

class _SignInState extends State {
final AuthService _auth = AuthService();

@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.brown[100],
appBar: AppBar(
backgroundColor: Colors.brown[400],
elevation: 0.0,
title: Text('Sign in to My App'),
),
body: Container(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0),
child: RaisedButton(
child: Text('Sign in'),
onPressed: () async {
dynamic result = await _auth.signInAnon();
if (result == null) {
print('error signing in');
} else {
print('signed in');
print(result);
}
},
),
),
);
}
}

@kevmoo
Copy link
Contributor

kevmoo commented Dec 16, 2020

Please file this issue with the repository for firebase_auth

@kevmoo kevmoo closed this as completed Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants