Skip to content
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

feat: Default authentication in Villus context #5

Open
kingkong404 opened this issue Oct 22, 2020 · 3 comments
Open

feat: Default authentication in Villus context #5

kingkong404 opened this issue Oct 22, 2020 · 3 comments

Comments

@kingkong404
Copy link

While the full login service is developed, I would appreciate it if we could have a basic auth setup for Villus based on default creds. Run the below function and then set context in Villus. Although I'm struggling to set the context after getting the token.

logaretm/villus#71

    async function logInto() {
      const logData = await useMutation(LoginDocument).execute({
        email: 'admin@example.com',
        password: 'changeme',
      });
   // Code to set context on Villus client for future requests. 
    }

    logInto();
@kingkong404
Copy link
Author

Looks like context in Villus has been depreciated. Any idea how you'd go about setting an Auth header with Villus after the Login Mutation?

@lewebsimple
Copy link
Collaborator

See https://villus.logaretm.com/guide/plugins#example:-adding-authorization-headers

@lewebsimple lewebsimple changed the title Basic Auth For Villus For Default Admin Account feat: Default authentication in Villus context Oct 23, 2020
@lewebsimple
Copy link
Collaborator

The credentials (i.e. default token) should be stored in an environment variable which would serve as a feature flag for this use case. Maybe AUTH_DEFAULT_TOKEN ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants