I have a few problems here. My site is written in Gatsby/React and I use the Netlify CMS. Everything works fine however I now need to add a user to my admin. I have enabled Identity and setup the invite users and emailed myself. The emailer works and directs to my homepage however it doesn’t throw the modal, so I set up a Login button and allowed Open Registration just to test it. It allows me to sign up, and then I can login and log out on the main page of my site no problem (there is nothing to log in or out of however, I only want CMS functionality) . So I have my basic admin index.html file:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<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>
my config.yml
`backend:
name: github
repo: csmaller/blog
media_library:
name: uploadcare
config:
publicKey: xxxxx
media_folder: content/assets
public_folder: ../assets
collections:
- name: blog
label: Blog
folder: content/blog
create: true
fields:
- {
name: isNews,
label: Is News,
widget: 'boolean',
default: false,
required: false,
}
- { name: path, label: Path }
- { name: date, label: Date, widget: date }
- { name: title, label: Title }
- { name: description, label: Description, required: false }
- { name: body, label: Body, widget: markdown }`
and my cms.js
import CMS from 'netlify-cms-app';
import uploadcare from 'netlify-cms-media-library-uploadcare';
CMS.registerPreviewStyle('/styles.css');
CMS.registerMediaLibrary(uploadcare);
when I access my admin page it goes directly to my blog posts and logs me in but when i open an incognito window and clear my cache my dummy email account that I invited cannot log in.
here is my netlifyAuth.js I included on my index page and tested out with a modal and it all “works” (meaning it logs me in and out)
import netlifyIdentity from 'netlify-identity-widget';
const netlifyAuth = {
isAuthenticated: false,
user: null,
initialize(callback) {
window.netlifyIdentity = netlifyIdentity;
netlifyIdentity.on('init', (user) => {
callback(user);
});
netlifyIdentity.init();
},
authenticate(callback) {
this.isAuthenticated = true;
netlifyIdentity.open();
netlifyIdentity.on('login', (user) => {
this.user = user;
callback(user);
netlifyIdentity.closeModal();
});
},
closeModal() {
netlifyIdentity.close();
},
signout(callback) {
this.isAuthenticated = false;
netlifyIdentity.logout();
netlifyIdentity.on('logout', () => {
this.user = null;
callback();
});
},
};
export default netlifyAuth;
type or paste code here