Skip to content

How to use in other projects? #25

@Danwhy

Description

@Danwhy

@nelsonic
What we've got so far is a working implementation of auth in an example app, but how should we go about using it in other projects?

Is the intention to keep the code in the form it is now when requiring it into other apps? By this I mean the logic being performed in the controllers so that all the parent application has to do is forward all requests to /auth endpoints to this application, rather than the alternative which, would just be exposing the functions in this app and the parent module calling these functions to perform authorisation.

You mentioned in dwyl/technology-stack#67 (comment) that Auth should eventually be its own, separately hosted umbrella app, so to me this does seem like a step towards that.

I have managed to get this method of integrating the apps working, but just wanted to check I wasn't heading in the wrong direction.

The main issue I had in getting this approach to work was the configuration. Dependency config files are not included when they are required as a dependency, as it is expected that the calling module will provide the config.
This was a problem as the Ueberauth plug that is being used in the auth_controller expects some configuration to be set before it is compiled, so an error was being thrown. My solution to overcome this was to use Application.put_env to set the config before the plug is called. This way we can set the config we want to specify in Auth, and also read from the parent app's config file (with Application.get_env), allowing certain configurations to be set.

Metadata

Metadata

Assignees

Labels

discussShare your constructive thoughts on how to make progress with this issuehelp wantedIf you can help make progress with this issue, please comment!questionA question needs to be answered before progress can be made on this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions