IntegrateWeb.Auth (IntegrateDB v0.1.0) View Source

Token based authentication logic using Phoenix.Token.

Link to this section Summary

Functions

Fetch user from the conn if there's a valid bearer token in the authorization header.

Generate auth tokens for a given user_id.

Verify a given candidate refresh_token.

Verify a given candidate token.

Link to this section Functions

Fetch user from the conn if there's a valid bearer token in the authorization header.

Returns %User{} or nil.

Generate auth tokens for a given user_id.

Returns {token, refresh_token}.

Link to this function

verify_refresh_token(conn, refresh_token)

View Source

Verify a given candidate refresh_token.

Returns {:ok, user_id} if valid, otherwise nil.

Link to this function

verify_token(conn, token)

View Source

Verify a given candidate token.

Returns {:ok, user_id} if valid, otherwise nil.