YipyipExAuth v0.2.0-alpha.1 YipyipExAuth.TestHelpers View Source
Helper functions for generating "valid" tokens for testing purposes.
WARNING: These functions should not be called outside of tests.
Link to this section Summary
Functions
Generate an access token. Default payload can be overridden. The default payload is
Generate a refresh token. Default payload can be overridden. The default payload is
Sets request header "authorization" to "Bearer access_token
".
Sets request header "authorization" to "Bearer refresh_token
".
Link to this section Functions
Link to this function
generate_access_token(token_context, config, payload_overrides \\ %{})
View Sourcegenerate_access_token( binary() | module() | Plug.Conn.t(), YipyipExAuth.Config.t(), map() ) :: binary()
Generate an access token. Default payload can be overridden. The default payload is:
%{epl: %{}, exp: nil, sid: "a", tst: :bearer, uid: 1}
Link to this function
generate_refresh_token(token_context, config, payload_overrides \\ %{})
View Sourcegenerate_refresh_token( binary() | module() | Plug.Conn.t(), YipyipExAuth.Config.t(), map() ) :: binary()
Generate a refresh token. Default payload can be overridden. The default payload is:
%{epl: %{}, exp: nil, id: "a", sid: "a", tst: :bearer, uid: 1}
Link to this function
put_access_token(conn, config, token \\ nil)
View Sourceput_access_token(Plug.Conn.t(), YipyipExAuth.Config.t(), binary() | nil) :: Plug.Conn.t()
Sets request header "authorization" to "Bearer access_token
".
Link to this function
put_refresh_token(conn, config, token \\ nil)
View Sourceput_refresh_token(Plug.Conn.t(), YipyipExAuth.Config.t(), binary() | nil) :: Plug.Conn.t()
Sets request header "authorization" to "Bearer refresh_token
".