Skip to content Skip to sidebar Skip to footer

Identity Toolkit Does Not Work - Error Code: Bad Response From Idp

The problem that I am currently unable to solve is bad response from IDP and the cause is supposed to be the lack of mode=select but I'm unaware now about the page where the mode=s

Solution 1:

You need to create two pages. Let's say url1 and url2.

url1 where you include your sign in button by running:

window.google.identitytoolkit.signInButton()

Set widgetUrl to url2

In url2 where you render the widget by running:

window.google.identitytoolkit.start()

Set the signInSuccessUrl to url1

Do not add ?mode=select to widget url. On sign in button click, it will automatically append it to that url and redirect there.

Solution 2:

signInSuccessUrl: 'http://www.lascuolacheverra.org/signin?mode=select', // i tried to add the mode=select here

This should not point to the /signin page. Maybe point it to / or /signed-in.

Also, remove

// signInOptions: ["google", "password"], // <-- this apparently masks out the idps

idps: ["Google", "AOL", "Microsoft", "Yahoo", "Facebook"],

I did some testing with this, and if I add signInOptions, then idps is ignored and you end up only being able to sign in with google and password.

Apparently only using signInOptions is the way to do it. I've read idps instead of signInOptions in other examples, and I'm using idps with success.

Update I misread the code a bit. I thought \signin was the page showing the widget, which the tutorials place under \widget. My mistake because in my project I'm replacing \widget with \secure-sign-in. So, if your \signin page is not the \widget page then your code was already OK. And in any case you should remove the ?mode=select because this is only used for the \widget and is added automatically by the window.google.identitytoolkit.signInButton function.

Solution 3:

Well, I was just encountering the same error "Error code: Bad response from IDP."

As stated in the comments above there are two possibilites:

  1. creation of a page with a SignIn-Button only and another one to which the previous one redirects on button click
  2. appending "?mode=select" to the url as a query parameter
  3. Redirect in your routes, for example on

    app.get("/login", function(req, res) {
      res.redirect("/login?mode=select");        
    }
    

The gitkit.jsextracts it from the browsers window.location.href.

Post a Comment for "Identity Toolkit Does Not Work - Error Code: Bad Response From Idp"