AuthPlug.Helpers (auth_plug v1.5.2)

Link to this section Summary

Functions

check_environment_vars/0 displays a friendly error message if the AUTH_API_KEY environment variable is not defined.

strip_struct_metadata/1 removes the Ecto Struct metadata from a struct. This is essential before attempting to create a JWT as Jason.encode/2 chokes on any invalid data. See: github.com/dwyl/auth_plug/issues/16

Link to this section Functions

Link to this function

check_environment_vars()

check_environment_vars/0 displays a friendly error message if the AUTH_API_KEY environment variable is not defined.

Link to this function

get_baseurl_from_conn(map)

@spec get_baseurl_from_conn(Map) :: String.t()

get_baseurl_from_conn/1 derives the base URL from the conn struct e.g: http://localhost:4000 or https://app.dwyl.com

Link to this function

strip_struct_metadata(struct)

strip_struct_metadata/1 removes the Ecto Struct metadata from a struct. This is essential before attempting to create a JWT as Jason.encode/2 chokes on any invalid data. See: github.com/dwyl/auth_plug/issues/16