Speakeasy.Plug (Speakeasy v0.3.2)

Absinthe context plug

Link to this section Summary

Functions

Callback implementation for Plug.call/2.

Get the authorization HTTP header bearer token

This plug is based off of the Absinthe example plug.

Link to this section Functions

Link to this function

call(conn, opts)

Callback implementation for Plug.call/2.

Link to this function

get_token(conn)

Get the authorization HTTP header bearer token

This plug is based off of the Absinthe example plug.

It takes two arguments:

load_user which accepts a 1 arity function that should return your user. It will receive the value of the bearer HTTP authorization header.

user_key the name of the map key to put the user under in the GraphQL context.

Examples

plug(Speakeasy.Plug, load_user: &some_function/1, user_key: :current_user)