-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot authenticate into Indiekit (hosted on Fly.io) #588
Comments
Hi @jayeless. Hmmm, this is a puzzle! I haven’t tried Indiekit with Fly.io yet because, as far as I can tell, it’s all configured using a CLI, is that correct? I have Fly.io in the back of mind for a host to document usage with, but right now you may be an unfortunate guinea pig in trying to use Indiekit with this provider. Given you are trying to change the application name, and that’s not working either, that might be a good aspect to try and debug first, as there might be something fundamental going on. Where are you saving your config, and what is the file called? There are a few different ways to provide configuration to Indiekit, have you tried some of these? I wonder if using the
Ideally, you should be able to configure your server to use IndieAuth.com instead of Indiekit’s own authentication feature. But I suspect something more fundamental is going on. The alternative is to revert back to 0.3.0, but I can understand why that’s not an attractive option either. |
Thanks @paulrobertlloyd for the response, and the help! And apologies in advance for the long and possibly meandering reply... To begin: I followed your suggestion to put my configuration directly into After some experimenting, it became pretty clear that my problem was trying to put my configuration in I tried re-copying the example config file and changing the absolute bare minimum (like my site URL) and that didn't work either. I didn't try to redeploy to Fly.io, but just testing it on my local computer, I got this error message:
When I followed one of the recommended solutions there and changed the suffix to
I did some web searches of the error messages, and basically, what I'm gathering is that there are two types of Javascript files, and one can use
but then it required me to rename
So, I don't really know what I'm doing at this point anyway, so I figure I should probably leave it for today. Up to here, my conclusion is: don't try to put config in On the topic of authentication though, even though Indiekit seems to be picking up config in either Thank you again for any and all help given! And on a side note, since you asked about Fly.io: yes, deployments through them are configured on the command line. |
@jayeless I'm using a custom post template in my Can you modify your
That method of exporting the function seems to work for me, for now. (It's related to your observation about |
@shoesandsocks Aha, thank you for this! That was the exact piece I was missing. I've been able to get my custom post template working now 😊 |
@shoesandsocks Thanks for your help on this. I suspected this may have been the case, but was unable to reply. It’s so lovely to see Indiekit’s nascent community help each other out ❤️ Unfortunately Cosmiconfig - which is what I’m using to load configuration files - doesn’t support ES modules, causing this confusion. And it looks like Cosmiconfig is now looking for a new maintainer. The rest of the project uses ES modules, but this is the one area there’s this constraint. It might be possible to resolve this by moving to Lilconfig, but this requires some investigation. @jayeless Back to your original question; are you now able to authenticate? |
@paulrobertlloyd Yes, using IndieAuth I'm able to authenticate now. I did give the in-built auth another try (for the sake of completionism) and it didn't work, but I don't mind using IndieAuth. So I'm all sorted now 😊 |
Looking at the lilconfig README it sounds like it would still require async loading of the config to support ES modules. Cosmic config does have a draft PR to add ESM support to v8 but the PR is 2+ years old and like you mentioned, that project is looking for a new maintainer. Regardless, it looks like ESM support would require changing indiekit to load the config async. |
Actually, it looks like someone has taken over the maintainer role on Cosmicconfig 🎉 |
Oh yeah! Sorta resigned myself to the non-maintained status, so didn’t actually check. Hopefully ESM support lands soon – will make things much simpler 🤞 |
I eventually figured this out. I think it might have been related to fly.io's CLI and shell commands. Wrapping the string values in single quotes seemed to work. |
That’s good to know, thanks for sharing the tip. I’ve been spending this weekend trying to understand Docker and create a config that can be used; having this will probably help in a lot of these cases given services like Fly, Render, Railway etc can use Dockerfiles. |
I'm at this step, but locally, can't authenticate with the password I have set in my .env file, i'm probably doing something wrong, but it's not clear, any hint ? edit : managed to get it working !
|
Closing this in favour of #540 which tracks the creation of a tutorial for hosting Indiekit on Fly.io. The initial issue surrounding the configuration file format has also been addressed, with v1.0.0 Beta 4 adding support for configuration files that use either the CommonJS or ES module syntaxes. |
Sorry haven't had the time, but i will try again with these fixes. |
Description of the bug
Hi there, I've been trying to get set up with an install of the latest Indiekit (1.0.0 beta 2), and since Heroku doesn't have a free plan any more, I've been trying to set it up on Fly.io.
I've been able to get Indiekit to run, but I can't authenticate into it. I believe I've set the relevant required environment variables – first SECRET (because Indiekit wouldn't let me create a new password until I'd set that), and then I created a password and used the generated hash to set PASSWORD_SECRET too. I set both of these using Fly's command-line tool. And I can verify that these are both set, using the command-line tool and via the web interface, although I can't inspect the contents of the variables (they're hashed).
My problem is that when I try to log in to Indiekit, and enter the password I'd used, the app just keeps telling me "Enter a valid password". I'm pretty certain the password is correct (I used Bitwarden to generate it and have been copying and pasting) so I feel like something's gone wrong with the environment variables, but I don't know what.
I also tried just sidestepping this problem by setting
application.authorizationEndpoint
andapplication.tokenEndpoint
to the old IndieAuth URLs, as per the documentation, but Indiekit seems to be ignoring that and just keeps sending me to its own password-based authentication screen. Unless I've misunderstood how providing an alternative authentication/token endpoint is supposed to work and a password is still a prerequisite. Or unless I've set it wrong, because to be fair, I also tried setting a customapplication.name
and I don't see the name I set that to anywhere. I did follow the format in the example config, copy-pasting the MongoDB URL line and changing the key and value (with quotes around the value strings). Basically that section goes:While on one level it'd obviously be better to understand why Indiekit's built-in authentication isn't working in the first place, I'd also be happy with a solution that let me revert to the old way of authenticating (which worked in 0.3.0).
Short of "abandoning Fly.io and trying a different host", I'm all out of ideas, but I also don't know why Indiekit wouldn't work on Fly.io. Anyway, apologies for my obvious inexpertise with things like this; I'm very thankful for all the work you've put into Indiekit and would appreciate any help understanding where this is going wrong 🙏
Steps to reproduce
No response
Expected behaviour
No response
Environment
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: