Problems logging into CMS - endless loop - using github auth, gatsby

Hi @uberannie, clearing the cache can help reduce the scope and would be helpful.
Does the browser reports any CORS errors or any other error on why the request is canceled?

Ok I did a couple of things which resolved it, could these inform what is going on?

  • cleared local storage
  • instead of using our prod URL/admin, I used the netlify URL/admin
  • CMS loaded as expected

(interestingly, after it loaded successfully using netlify URL/admin, using prod URL/admin also works :exploding_head: But going prod URL/admin first resulted in endless loop…

Question - should both /admin URLs work or should we only use the Netlify generated URL ?

1 Like

could not see anything re CORS problems. On the failed fetch on settings and user Referrer Policy was listed as same-origin, if that is significant?

Both URLs should work.
Do you have any warnings in the custom domain management section in Netlify?
I’m assuming curl -i "https://prod domain/.netlify/identity/settings" fails and curl -i "https://netlify domain/.netlify/identity/settings" succeeds?

Hi Erez, there’s only a warning regarding an apex domain.

Not sure if related but should the CMS work on branch deploys? ie [branch url]/admin ? I’m getting the following error - but everything seems ok so far re our prod site…

The CMS should work on branch deploys, that might be another issue (again we would need to look at the traffic to figure this out).
Please note that unless you configure the CMS to connect to a specific branch it will always connect to the default branch.
Meaning branch deploys and prod will connect to the default branch.
You can dynamically update your config.yml during build time to get the CMS to connect to the specific deploy branch.

backend:
  name: git-gateway
  branch: master

Netlify supplies a HEAD env variable you can use for that purpose.

:+1:
OK so I think our prod “endless loop” issue might be OK I’ll have to check in with the rest of the team - I can’t replicate now so I’ll get them to clear cookies/local storage etc to see if that resolves their issue as it seems to have fixed it on my machine, for our prod site :crossed_fingers:

Still seeing endless loop issue on our branch deploy, clearing cookies etc doesn’t seem to resolve :frowning: I wasn’t involved in the setup so might have to do a bit of digging on how it was setup.

The curl returns a json payload which I imagine is OK

OK running in FF still having endless loop however console output looks slightly different, is this of value?

Yes, there should be a request to retrieve the config.yml file. You should verify the response has the expected content of your config file.

In the initial log there was this line:

VM131 cms.js:1 CMS_MANUAL_INIT flag set, skipping automatic initialization.’

So there won’t be a request for config.yml

even with manual initialisation it tries to load the config file and merges it with the manual config unless you pass in load_config_file: false.

See the code comments here: https://www.netlifycms.org/docs/beta-features/#manual-initialization

Infinite loops are very common problem in OAuth authorizations

hey guys, sorry been a bit quiet as we’re busy busy working through some deadlines to release the next version of our public website :dizzy:

so we’re still having it intermittently and randomly amongst team members - some no issues, some every now and then.

was chatting with one of our engineers, is there anything in the codebase that has some dependencies between calls, as a race condition? the theory that one call is waiting for another but timing is messing things up. One suggestion was to apply a “slow 3G” network mode in Chrome. This has actually “fixed” the issue so wondering if the forced slower connection helps manage the orchestration of calls?

Our team are all based in Melbourne, Australia

this is heartening… :flushed: any tips for how they can be addressed?

It’s always* mistake on side of developer. He need to properly configure gateway. But i had infinite loop caused by one of my webbrowser addons. So you need to deactivate addons and check which one cause whole problem. Mostly: adblockers; ghostery and similiars;cookie editors;css exfil protection and other shields against suspicious parts of code.

@uberannie sorry to hear the issue is still happening.
Let’s try and focus on the logs and errors we can reproduce.
Is the only current standing issue is with Firefox as mentioned here?

If so, I think my comment from here Problems logging into CMS - endless loop - using github auth, gatsby might be still relevant.

Otherwise, what is/are the current issue/s team members are experiencing? We should have a clear list of what is resolved and what is not.

I’m having a similar issue trying to login to my Gatsby site netlify CMS with GitHub or Google Authentication. But when I try to login, I get “Your Git Gateway backend is not returning valid settings. Please make sure it is enabled.” It is most definitely enabled.

Clearing cache and cookies just allowed me to complete external authentication. Otherwise, the Login with Netlify Identity Button just repeats the error message.

I solved my issue by customizing my authentication email templates (saved to the Gatsby project “/static/admin/” folder where the Netlify CMS lives) following this post.

For noobs like me, it is worth pointing out that when you point Netlify to the location of these custom email templates in Settings->Identity->Emails, you drop the static folder, so the location for me was: “/admin/invitation.html”

For Netlify folks looking at this, please update the NetlifyCMS instructions for Gatsby. These instructions do not work if you’re not using Identity for sitewide login (and only want login to NetlifyCMS for yourself/small team for a personal website). Given that this is a known issue with email confirmation setup, the quickstart steps should direct changes to custom email templates to target the /admin/ site in the common case where Identity is not working for the site as a whole, OR streamline installation in a way that obviates this set of steps.

Also, it would be useful to at least link out to other posts that provide a bit more detail about setting up logins and how the CMS system should behave (I take it basically the same way on the server and local side) would help lower the hurdles for those just getting started with Netlify, Gatsby, Hugo, etc. The current instructions are too brief IMO.

1 Like

Hi @drwilkins, welcome to the community and sorry for taking this long to respond.
Thank you for sharing your solution.
When using the Gatsby CMS plugin it adds the identity widget to the root on the site by default (and to the CMS sub path e.g. admin), so customising emails templates shouldn’t be required.
Can you share the steps you performed?
It would make it easier to improve the docs.
Regardless we are always open to contributions to the docs and the CMS in general :smiley:

I just had the same issue right now. This never happens to me, but all of a sudden it did right now. I will check out the solution, but I should not have to make any changes to my config because it normally works! What could be going on? All I do is click on the button, it takes me to a login with email and password or via Github, and when I click on Github, it takes me back to the identity button. Please advise. Right now I cannot post to my blog.