AE
Ash Elixir•3y ago
kernel

Auth0 and AshAuthentication

with AshAuthentication and auth0, what should I specify as the user resource attributes? like, email etc etc, what if I want different roles? i.e: admin users and normal users? can I specify a role attribute on the resource - and have that saved in auth0 somehow?
14 Replies
ZachDaniel
ZachDaniel•3y ago
From a coworker who use ash_authentication for auth0:
nope, I made a deliberate choice to control that information within our app and not Auth0 the only thing Auth0 (or any Identity Provider) does is authenticate that a user is who they say they are roles and other metadata is kept within our app
In terms of specifying the user resource attributes, that part I'm not sure I understand. Seems like a separate question perhaps? It looks like they use an identity resource and do things like this for configuring scopes:
authorization_params(scope: "list of scopes")
authorization_params(scope: "list of scopes")
kernel
kernelOP•3y ago
I'm also having an issue with ash_authentication_phoenix throwing an error about MagicLink something something
== Compilation error in file lib/ash_authentication_phoenix/components/sign_in.ex ==
** (CompileError) lib/ash_authentication_phoenix/components/sign_in.ex:146: AshAuthentication.Strategy.MagicLink.__struct__/0 is undefined, cannot expand struct AshAuthentication.Strategy.MagicLink. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code
== Compilation error in file lib/ash_authentication_phoenix/components/sign_in.ex ==
** (CompileError) lib/ash_authentication_phoenix/components/sign_in.ex:146: AshAuthentication.Strategy.MagicLink.__struct__/0 is undefined, cannot expand struct AshAuthentication.Strategy.MagicLink. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code
latest versions of all things
ZachDaniel
ZachDaniel•3y ago
Hate to ask, but are you sure you're on latest? Others have seen that issue and upgrading resolved it including me Might be worth deleting _build
kernel
kernelOP•3y ago
doesn't work, on latest 😦
ZachDaniel
ZachDaniel•3y ago
🤔 I'm like... 99% sure I'm on the latest of both oh delete your deps? No that doesn't make sense nvm try main of both? I'm currently working on main of both and that is 100% working for me literally implementing google oauth and have main cloned down locally for both 😆 if the latest version of both together doesn't work we'll release a new version
kernel
kernelOP•3y ago
No description
kernel
kernelOP•3y ago
yeah I might try main
ZachDaniel
ZachDaniel•3y ago
latest of ash_authentication is 3.9.5
kernel
kernelOP•3y ago
! guides need updating haha
ZachDaniel
ZachDaniel•3y ago
which guide? I'll fix it (to not include version numbers)
kernel
kernelOP•3y ago
https://hexdocs.pm/ash_authentication/readme.html#installation im a bit dumb and didn't look at the latest version on top left
ZachDaniel
ZachDaniel•3y ago
okay in future versions it will update when the version changes will be wrong until a new version deploys though
kernel
kernelOP•3y ago
this is more like, what fields are required for auth0 to work? I'm assuming email at bare minimum I'll take a look at the oauth strategy and see what it does actually ignore me, I am looking at the action and see that user_info is an argument to the create action, I'm going to assume I can just pluck whatever I want out of there and have it in my local user resource
ZachDaniel
ZachDaniel•3y ago
Yep!

Did you find this page helpful?