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

Inject and Credientials #292

Open
charliewilco opened this issue Jan 3, 2019 · 1 comment
Open

Inject and Credientials #292

charliewilco opened this issue Jan 3, 2019 · 1 comment

Comments

@charliewilco
Copy link

working writing some unit tests.

the token is a valid token.

trying to authenticate my request like this:

    const response = await server.inject({
      method: "GET",
      url: "/api/posts",
      headers: {
        Authorization: token
      }
    });

and this:

    const response = await server.inject({
      method: "GET",
      url: "/api/posts",
      credentials:  token
    });

both are giving me false positives.

i setup my auth strategy like this

  await server.register(require("hapi-auth-jwt2"));

  server.auth.strategy("jwt", "jwt", {
    key: Config.key,
    validate: validate,
    verifyOptions: {
      algorithms: ["HS256"]
    }
  });

does anyone have any clarity on how i should be using server.inject() with this plugin?

@Mohamed-Abbas
Copy link

how did you solve this ?

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

No branches or pull requests

3 participants