Tutorial needs authentication included, in version 5, or other authentication working example

All the example apps with authentication I can find are stuck in version 3, and have so many problems trying to get them to work in v5. If you want new people to stick with Ember and use modern versions, this seems like the biggest thing the ember community could do. The tutorial noticeably stops without including it, in an app that surely requires it to be realistic.

what are the main issues or discrepencies that you’re finding between 3 and 5 (of which package(s)?)

I’ll share my attempts to get authentication to work, and hopefully the community will rally to get it included in the tutorial or at least provide a standalone demo app of authentication.

Below you’ll see a lot of detail, but my main point is that as far as I know packages needed for a working app haven’t been updated to be compatible with ember 5. If authorization were included in the tutorial, the community would clean up these kind of issues every time ember was updated, instead of a newbie having to face them. The newbie could instead get a shell of a working (authenticated) app, and learn from there.

__________________________________

The two demo apps I’ve found both use ember-simple-auth, and are from MainMatter:

Classic Test App

Test-App

I will focus on the Classic Test App. I’m using ember-cli 5.3, node 18.18.2.

The test app says it’s also using ember-cli 5.3, but I doubt the MainMatter people have tested their apps in a new modern environment with 5.3, because they don’t build without a lot of work, and then have errors.

Problems and solutions:

  1. “npm ERR! Unsupported URL Type "workspace:": workspace:../classic-test-app/lib/my-engine”

solution: changed to “file:lib/my-engine”. Is workspace used only with yarn?

  1. ember-engines is not compatible with modern ember-source
“npm ERR! Could not resolve dependency:
npm ERR! peer ember-source@"^3.24.1 || 4" from ember-engines@0.9.0
npm ERR! node_modules/ember-engines
npm ERR!   dev ember-engines@"0.9.0" from the root project

solution: In the end, I had to clone the ember-engines repo and made the change and then installed that local package.

  1. Error in ember-engines component: “class LinkToExternal extends LinkComponent”

test work around: deleted all references to engines in the app.

  1. Error in callback route

test work around: deleted callback route

  1. Error missing manifest

As you can see it goes on and on.

Thanks.

Sorry to see you’re having trouble!

It looks like you missed the CONTRIBUTING.md on that repo, as well as some details about how to get started – but no worries! this is easy to miss!

Namely, it looks like you’re using npm instead of pnpm, which is a choice that any repo maintainer is free to make, and pnpm is quite good if you want to look in to it – anywho – always a good thing to double check which package manager a project is using before diving in and blaming the community for this sort of stuff :wink:

using pnpm instead of npm would have solved all 5 of your problems.

I just checked by:

  • cloning the repo
  • cd ember-simple-auth
  • pnpm i
  • cd packages/test-app
  • pnpm ember test
  • all tests pass with exit code 0.

Hopefully this helps!

If you want more immediately / synchronous help, feel free to join our chat community here: emberjs

Lots of folks (including me) are more than happy to help, Live! :tada:

Thanks NullVox, you’re right pnpm was the solution. I really appreciate it.

I also appreciate MainMatter for providing the demo apps! (The classic-test-app does have a run error…I guess avoid the word “classic” when possible).

But I think my ignorance and stumbles helps make the case that authentication needs to be included in the tutorial, or at least a demo app should be included in Ember documentation. I searched the Ember Guides, and didn’t see any help on authentication.

I know the tutorial can’t include everything, but it seems like a session on implementing ember-simple-auth would cap it off nicely, as authentication is so common in apps.

1 Like

I agree that we need more authentication tutorials!

There are many ways to do authentication!

I agree, but it’s also a weird line to draw for any framework docs/guides. I don’t want to speak for the learning team but IIRC they’ve stated that the guides should be pretty barebones by design and only include framework-included functionality. Authentication is weird because, as you mentioned, it’s super common, but it’s not universal. It’s a weird line to draw because it becomes a slippery slope. Ember simple auth is also a third party addon (even though out of all the addons in the ecosystem it’s about as close as you can get to being “official”). If auth why not ember concurrency? Or mirage? CSS? Even the tight integration of Ember Data in the docs is somewhat controversial.

Taking a look at other frameworks (Vue, Astro, etc) they have a similar gap around “official” docs for auth which I assume is much for the same reasons. Something that has been discussed is some sort of official or semi-official cookbook or examples. It’s a hard thing to get right though, and it’s a lot of content to keep updated. I know @NullVoxPopuli has some really great content in this ballpark.

One thing that maybe COULD live in the official docs, and probably could have helped with your issue, is more guides coverage on package managers and especially workspaces. This gets into the same problem, there are a lot of package managers and you don’t want to artificially shove people in one direction, but for workspaces pnpm is by far the easiest to use so it seems like a solid recommendation. I dunno though :person_shrugging:

we are working on adding a few examples of authentication of requests to the new EmberData guides, though not in the “give me a fully functioning app with user flows for login” sort of way. Auth is very much something there can’t really be a guide for considering every app will handle it uniquely, but it is something we can show a few happy path patterns for where common approaches exist.

1 Like

Sounds great, thanks.