How to login local CMS?

Hi,

I can see login page at http://localhost:8000/admin/#/ but don’t know how to obtain login info. Tried my netlify id, but as expected it didn’t work. Any tips?

static/admin/index.html looks like this:

<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Content Manager</title>
</head>
<body>
  <!-- Include the script that builds the page and powers Netlify CMS -->
  <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>

Can you share your config.yml file? If you’re using git-gateway, you have to register through Netlify Identity.

Sure:

backend:
  name: git-gateway
  local_backend: true
  branch: master
  commit_messages:
    create: 'Create {{collection}} “{{slug}}”'
    update: 'Update {{collection}} “{{slug}}”'
    delete: 'Delete {{collection}} “{{slug}}”'
    uploadMedia: '[skip ci] Upload “{{path}}”'
    deleteMedia: '[skip ci] Delete “{{path}}”'

media_folder: static/img
public_folder: /img

collections:
  - name: config
    label: Site Configuration
    files:
      - name: config
        label: Site Configuration
        file: site-metadata.json
        fields:
          - widget: string
            name: title
            label: Title
            required: true
          - widget: string
            name: description
            label: Description
            required: true
          - widget: select
            name: palette
            label: Color Palette
            required: true
            hint: The color palette used for the website.
            options:
              - Blue
              - Green
              - Black & White
  - name: people
    label: Our Team
    folder: /src/team/
    create: true
    extension: md
    slug: '{{slug}}'
    identifier_field: personname
    fields:
      - widget: string
        name: personname
        label: Name
        required: true
      - widget: string
        name: email
        label: Email Address 
        required: false
      - widget: string
        name: phone
        label: Phone Number of the person
        required: false
        hint: "E.g.: 999.555.9999"
      - widget: image
        name: personimage
        label: Image
        required: false
      - widget: markdown
        name: personprofile
        label: Person Profile
        required: false
      - widget: hidden
        name: template
        label: Template
        required: true
        default: page
    filter:
      field: template
      value: page

  - name: pages
    label: Pages
    files:
      - name: about
        label: About
        file: /src/about/index.md
        fields:
          - widget: string
            name: title
            label: Title
            required: true
          - widget: string
            name: subtitle
            label: Subtitle
            required: false
            hint: The text shown below the page title
          - widget: image
            name: image
            label: Image
            required: false
            hint: The image shown below the page title
          - widget: hidden
            name: template
            label: Template
            required: true
            default: page
          - widget: markdown
            name: body
            label: Content
            required: false
            hint: Page content

      - name: testimonials
        label: Testimonials
        file: /src/testimonials/index.md
        widget: list
        fields:
          - widget: string
            name: quote
            label: Quote
            required: true
            hint: Client's testimonial
          - widget: string
            name: author
            label: Author
            required: false
            hint: Client's name
      - name: contact
        label: Contact Information
        file: /src/contact/index.md
        widget: object
        fields:
          - widget: string
            name: location
            label: Location name
            required: false
          - widget: string
            name: address
            label: Address
            required: true
          - widget: string
            name: email
            label: Email Address
            required: false
          - widget: string
            name: phone
            label: Phone
            required: false
          - widget: string
            name: fax
            label: Fax Number
            required: false

Have you followed these steps?

2 Likes

Hi @abdu, you should include the identity widget if you’re using Netlify identity:

<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Content Manager</title>
  <script type="text/javascript" src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
  <!-- Include the script that builds the page and powers Netlify CMS -->
  <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>
1 Like

Hi @tomrutgers, @erez.

I didn’t add identity script. The index.html is same as shown in the first message in this topic.

I don’t exactly remember , but I think it was an issue with netlify identity settings. I enabled identity, reconnected github repo, and now it works. When connecting to /admin in local, it first asks netlify address. So, everything is fine. Thanks for your reply.

Now I have to figure out how to show content created in CMS in the actual pages. :slight_smile: The starter I used didn’t have Netlify CMS integration, so I edited js files (like about.js for /about page). I’m guessing I have to have a template and use graphql to bring data from CMS file. Any tips or resource recommendations are highly appreciated.

Thanks as always, cheers.

2 Likes

Glad you got things worked!

1 Like

I want to follow up on this for I am having a similar issue. I have git gateway working and when I log into the live site, I am taken to the CMS as expected. However when I do the same locally I am just forwarded to the live site CMS.

My steps:
Go to localhost:8000/admin
Log in Git Gateway with my Google account (could the issue be here?)
End up on my live CMS

I have tried the same steps by logging in with my GitHub account but still have the same result.

My config.yml

backend:
  name: git-gateway
  local_backend: true
  branch: master

publish_mode: editorial_workflow

media_folder: static/img
public_folder: /img

site_url: https://ohmni-temp.netlify.app

display_url: https://ohmni-temp.netlify.app

logo_url: https://ohmni-temp.netlify.app/img/logo-title.svg

I added local_backend like in some of the examples I have seen. I have also followed the steps provided above but I don’t believe that it is the same situation.

Am I missing something here to have the ability to access my CMS locally?

External OAuth providers do not work on localhost. You can still log in with a username and password. You can also test your config with the test backend or hook up a local git repo.

Hi @byebyers if you are trying to access your cms locally, the local_ backend config should not be under backend. Try some like so:

backend:
  name: git-gateway
  branch: master

local_backend: true

Also, don’t forget to run npx netlify-cms-proxy-server from the root directory of your local git repo to start up the express server.

True, but login with the GitHub and Google account buttons still won’t work, right?

The login button(Github, etc) won’t show up. With the local_backend config, if the CMS detects a proxy server it’s actual overrides the backend config to something like so

backend:
  name: 'proxy'
  proxy_url: 'xxx...'
1 Like

Hi,

Documentation is misleading. Please see this.

Thank you @tomrutgers @Barth & @abdu

Reading your examples did help me realize that I needed to run the npx command then open a new terminal window to run gatsby develop for my set up to access the local cms.

For other noobs like myself. You add this to the top level of your config files as explained the examples above.

backend:
  name: git-gateway
  branch: master

local_backend: true

Then in the root directory of your netlify project run the following command

npx netlify-cms-proxy-server

Then open a new terminal window, navigate to the same repository and run gatsby develop

Then you are at your local cms. Again thank you, everyone!

3 Likes

thanks, this works for me.

If you want to play around use a template. You can get started in less than 5 minutes.

Hello, for me this is not working I’m stuck on login with netlify indentity screen, when i click on it just backdrops without any errors. Any thoughts?

Welcome to the community @SupremeSalvatore!

I would check if identity is turned on in your netlify portal. It may not be connected to your account.

1 Like

It definitely is, however I found the issue this morning, I was always pinging network URL instead of localhost -.-.
Thanks for quick tip however!

2 Likes