Home
Support Forums

After login, redirected to the Homepage

Hello! I’m running a Hugo instance with the Doks theme. I have Identity enabled, using GitHub as a provider, along with Git Gateway. After logging into the CMS at /admin, instead of being brought to the editor, I’m brought to the Homepage with this anchor –

/#access_token=XYZ&expires_in=3600&refresh_token=ABC&token_type=bearer

Manually going back to /admin restarts the login process. I haven’t seen this before on other sites, running identical configuration. I’m stumped!

Bottom of Homepage

  <script>
    if (window.netlifyIdentity) {
      window.netlifyIdentity.on("init", user => {
        if (!user) {
          window.netlifyIdentity.on("login", () => {
            document.location.href = "/admin/";
          });
        }
      });
    }
  </script>

  </body>
</html>

admin/config.yml

backend:
  name: git-gateway
  repo: robpetrin/neta-docs
  branch: main

media_folder: 'static/images/uploads' # Folder where user uploaded files should go
public_folder: '/images/uploads'

collections: # A list of collections the CMS should be able to edit

# Contributors
  - name: 'contributor' # Used in routes, ie.: /admin/collections/:slug/edit
    label: 'Contributors' # Used in the UI, ie.: "New Post"
    folder: 'content/contributors' # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    fields: # The fields each document in this collection have
      - { label: 'Title', name: 'title', widget: 'string' }
      - { label: 'Publish Date', name: 'lastmod', widget: 'datetime' }
      - { label: 'Description', name: 'description', widget: 'text' }
      - { label: 'Draft?', name: 'draft', widget: 'boolean', required: false}
      - { label: 'Body', name: 'body', widget: 'markdown' }

# Docs
  - name: 'docs' # Used in routes, ie.: /admin/collections/:slug/edit
    label: 'Docs' # Used in the UI, ie.: "New Post"
    folder: 'content/docs' # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    fields: # The fields each document in this collection have
      - { label: 'Title', name: 'title', widget: 'string' }
      - { label: 'Publish Date', name: 'lastmod', widget: 'datetime' }
      - { label: 'Description', name: 'description', widget: 'text' }
      - { label: 'Lead/Intro', name: 'lead', widget: 'text' }
      - { label: 'Draft?', name: 'draft', widget: 'boolean', required: false}
      - { label: 'Body', name: 'body', widget: 'markdown' }
      - label: "Tags"
        name: "tags"
        widget: "relation"
        collection: "tags"
        search_fields: ["title"]
        value_field: "title"
        display_fields: ["title"]
        multiple: true
        options_length: 40
      - label: "Contributors"
        name: "contributors"
        widget: "relation"
        collection: "contributors"
        search_fields: ["title"]
        value_field: "title"
        display_fields: ["title"]
        multiple: true
        options_length: 20

# Tags
  - name: 'tags' # Used in routes, ie.: /admin/collections/:slug/edit
    label: 'Tags' # Used in the UI, ie.: "New Post"
    folder: 'content/tags' # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    fields: # The fields each document in this collection have
      - { label: 'Title', name: 'title', widget: 'string' }
      - { label: 'Publish Date', name: 'lastmod', widget: 'datetime' }
      - { label: 'Description', name: 'description', widget: 'text' }
      - { label: 'Draft?', name: 'draft', widget: 'boolean', required: false}
      - { label: 'Body', name: 'body', widget: 'markdown' }
      - { label: 'Tags', name: 'tags', widget: 'list',  required: false}
      - { label: 'Categories', name: 'categories', widget: 'list', required: false}

admin/index.html

<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>neta admin</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>

…I realized I missed a step. Please disregard. Thank you!