question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem using SignInWithEmailAndPassword

See original GitHub issue

Just starting with Firebase, and discovered your posts and libraries. When i have my rules set to anonymous access (write and read), i can post to the database.

When i try with a email login, i always get the error: { “error” : “Could not parse auth token.” } auth.user shows the correct email and Id.

This is the code i’m using:

        var firebase = new FirebaseClient(databaseUrl);
        var authProvider = new FirebaseAuthProvider(new FirebaseConfig(apiKey));      

        var auth = await authProvider.SignInWithEmailAndPasswordAsync( xxxx , yyyy );

        var db = firebase
            .Child("SanPrg2")
            .WithAuth( auth.FirebaseToken );

        var d = new Dinosaur { Height = 20 };
        await db.PostAsync(d);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Ravaleshcommented, Nov 10, 2016

@joanlopez

try this:

var account = new Accounts();

        account.Name = "jj";
        account.Email = "jj@g.com";

        var authProvider = new FirebaseAuthProvider(new FirebaseConfig(<API KEY>));
        FirebaseAuth auth = await authProvider.SignInWithEmailAndPasswordAsync(<Email>, <Password>);

        var firebase = new FirebaseClient("<Firebase URL>");


        var accounts = await firebase
            .Child("users")
          .WithAuth(auth.FirebaseToken)
           .PostAsync(account, false);

The extra parameter(generate key offline) in the PostAsync method solved the issue. I guess when the key is generated offline, it would make the request URL very large and the HTTP request handler will not be handle that.

0reactions
joanlopezcommented, Nov 15, 2016

Finally it worked for me!

Thanks!

PD: Sorry for replying on an replicated issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

facing problems with firebase signInWithEmailAndPassword
1 Answer 1 ... You have to import the initialized app from your firebase.js file and use getAuth(app) to start using authentication. Instead...
Read more >
[firebase_auth] signInWithEmailAndPassword returns error ...
This refactor addresses a bug where signInWithEmailAndPassword was returning an error code as "unknown" (GitHub issue: firebase/flutterfire/ ...
Read more >
signInWithEmailAndPassword never resolves nor reject
Exactly. But i think signInWithEmailAndPassword need to be imported from firebase/auth. It seems than signInWithEmailAndPassword stuck in an " ...
Read more >
Authenticate with Firebase using Password-Based ... - Google
You can use Firebase Authentication to let your users authenticate with Firebase using their email addresses and passwords, and to manage your app's ......
Read more >
Authenticate with Firebase using Password-Based Accounts ...
You can use Firebase Authentication to let your users authenticate with Firebase using their email addresses and passwords, and to manage your app's ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found