authable v0.10.0 Authable.Authentication.Session

Bearer authencation helper module, implements Authable.Authentication behaviour.

Link to this section Summary

Functions

Authenticates resource-owner using session_token token value

Link to this section Functions

Link to this function authenticate(session_token, required_scopes)

Authenticates resource-owner using session_token token value.

It matches resource owner with given session_token. Since Session auth represents resource owners direct access to resources, it does not require any scope check for authorization. If any resource owner matched given credentials, it returns {:ok, Authable.Model.User struct}, otherwise {:error, Map, :http_status_code}

Examples

# Suppose we have a session_token at 'token store(Authable.Token)'
# with token value "st123456789"
# If we pass the token value to the function,
# it will return resource-owner.
Authable.Authentication.Session.authenticate("st123456789", [])