authable v0.6.2 Authable.Authentication.Token

Base token authentication helper, implements Authable.Authentication behaviour. Differently from Bearer or Session, this module is a generic helper module. It enables to match with any token type from ‘token store(Authable.Token)’.

Summary

Functions

Authenticates resource-owner using given token name and value pairs

Functions

authenticate(arg, required_scopes)

Authenticates resource-owner using given token name and value pairs.

It matches resource owner with given token name and value. If any resource owner matched given credentials, it returns Authable.Model.User struct, otherwise {:error, Map, :http_status_code}.

Examples

# Suppose we store a confirmation_token at 'token store'
# with token value "ct123456789"
# If we pass the token value to the function,
# it will return resource-owner.
Authable.Authentication.Token.authenticate({"confirmation_token",
  "ct123456789"}, ["read", "write"])