Netlify-cms: Fix local access to the CMS when using Netlify Identify and External login

Created on 30 Oct 2017  Â·  13Comments  Â·  Source: netlify/netlify-cms

- Do you want to request a feature or report a bug?

Bug

- What is the current behavior?

When using Netlify Identify, browsing http://localhost/admin will first ask to add Netlify site URL but then redirect the user to that URL once logged in, instead of being able to test locally.

- If the current behavior is a bug, please provide the steps to reproduce.

  1. Setup project with files as per documentation, having admin/index.html, admin/config.yml and insert identify script under index.html
  2. Spin a server and go to http://localhost/admin
  3. A modal popup asks for pointing to the Netlify Website
  4. After that, we sign in.
  5. Get redirected to Netlify URL rather than local server

- What is the expected behavior?

Users should be able to test the NetlifyCMS locally through localhost/admin

- Please mention your CMS, node.js, and operating system version.

CMS 0.5.0

extensionbackends needs vendoring

Most helpful comment

I found that when entering at subdomain.netlify.com it will fail unless you add https — http will validate, but it fails on authentication.

also use localStorage.removeItem("netlifySiteURL"); in the browser console to reset as seen at https://github.com/netlify/netlify-identity-widget#faq

All 13 comments

@zanona Were you trying to login with an external provider (GitHub, Google, etc.), or an email and password?

Hi @tech4him1, I am trying to login through Github. So it gets redirected to Netlify URL after signed in with Github.

For me it is working with email/password login, it is just redirecting if I login with GitHub (or another external provider). This seems to be a bug with the Identity widget, so I created an issue there: https://github.com/netlify/netlify-identity-widget/issues/86.

Thanks, @tech4him1. I will follow through there. Will certainly use email/password for now in order to test locally. :) thanks for the tip.

This should now be fixed (0.7.6), please re-open if not.

@erquhart This is still an issue for me, although it is really an issue in Identity (https://github.com/netlify/netlify-identity-widget/issues/86), not in the CMS. Do you want to leave this open here, or not?

@tech4him1 we can leave this open to avoid duplicates until addressed.

I found that when entering at subdomain.netlify.com it will fail unless you add https — http will validate, but it fails on authentication.

also use localStorage.removeItem("netlifySiteURL"); in the browser console to reset as seen at https://github.com/netlify/netlify-identity-widget#faq

External login is an upstream issue for https://github.com/netlify/netlify-identity-widget, not something we can handle here. Closing.

Does it works with a Jekyll site? i can not test in a localhost env. it redirect me everytime to my host site....

As a workaround, I was able to access the CMS on localhost by taking the access token returned in the URL after logging in with external provider and appending it to the URL localhost:8000/admin

Can we open the CMS locally if we have only enabled Github for the authentication and authorization. For me, the production site works fine, but i cannot login locally. Any solutions for this?

Can we open the CMS locally if we have only enabled Github for hentication and authorization. For me, the production site works fine, but i cannot login locally. Any solutions for this?

Just to update on this thread as I have figured it out. This works locally perfectly. What i was doing wrong was the site name. The site name configured was with www subdomain, but apparently looking from the network logs it was pointing without the subdomain. I had to change the internal storage of the browser, as it won't ask again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BerkeleyTrue picture BerkeleyTrue  Â·  3Comments

andresalerno picture andresalerno  Â·  3Comments

papandreou picture papandreou  Â·  3Comments

ciokan picture ciokan  Â·  3Comments

chriskirknielsen picture chriskirknielsen  Â·  3Comments