Authorization
Learn how to implement the authorization feature.
We'll cover the following...
Permissible actions
In this last lesson, we tackle authorization: deciding if an action is permissible. The action we really care about is joining a Channel. The rules for this are simple. We want only two players to join a Channel on any given topic-subtopic and also want those two players to have different screen names.
Authentication resources
In Islands, we don’t need authentication—determining if users are who they say they are. If your application needs authentication, there are resources out there to help. Check out the documentation for
Phoenix.Token
if token-based authentication is needed.
Now that we have Presence, we can write functions to check both of the authorization conditions we outline. We can roll them into a single function that determines whether a given player can join.
The first condition we need to check is the number of players that have already joined ...