AccessPass v0.1.4 AccessPass
This is the main Public api and out of the box all you will use. Includes everything you need for all your authentication needs.
Link to this section Summary
Functions
Calling will update user password for related password_id
Marks a user email confirmed based on the given confirm_id
calling will send a forgot_username email to the email(if it exists in system)
Checks if the given access token is not revoked or expired and returns the data stored for it
Register a new user
calling logout will revoke both access_token and refresh_token for the given access_token
Refresh for a new access_token given a refresh_token
Register a new user
calling will set a reset password email to the linked email account of the username
Link to this section Functions
Calling will update user password for related password_id
Returns {:ok}
.
Examples
iex> AccessPass.change_password("ODhhMDgzYwfefdfeC00YjgyLWFiZGMtZTJjOWZiMzJjODhi","myNewPassword")
{:ok}
Marks a user email confirmed based on the given confirm_id
Returns {:ok, "email confirmed"}
.
Examples
iex> AccessPass.confirm("ODhhMDgzYwfefdfeC00YjgyLWFiZGMtZTJjOWZiMzJjODhi")
{:ok, "email confirmed"}
calling will send a forgot_username email to the email(if it exists in system)
Returns {ok: "sent email with related username"}
.
Examples
iex> AccessPass.forgot_username("myemail@gmail.com")
{ok: "sent email with related username"}
Checks if the given access token is not revoked or expired and returns the data stored for it
Returns {:ok,{user: "data"}}
.
Examples
iex> AccessPass.logged?("ODhhMDgzYjctZTE3OC00YjgyLWFiZGMtZTJjOWZiMzJjODhi")
{:ok, {username: "jordiee"}}
Register a new user
Returns {"ok":
{
"type":"TYPE",
"refresh_token":"refresh token",
"refresh_expire_in": seconds,
"access_token":"access_token",
"access_expire_in": seconds
}
}
Examples
iex> AccessPass.login(%{
username: "example",
password: "otherexample",
})
{"ok":
{
"type":"basic",
"refresh_token":"MjNmYzgzNGMtMGM3MS00YTA4LTkxMWMtNDEyODU3Yzk2ZTgy",
"refresh_expire_in":1200,
"access_token":"ODhhMDgzYjctZTE3OC00YjgyLWFiZGMtZTJjOWZiMzJjODhi",
"access_expire_in":600
}
}
calling logout will revoke both access_token and refresh_token for the given access_token
Returns {:ok}
.
Examples
iex> AccessPass.logout("ODhhMDgzYwfefdfeC00YjgyLWFiZGMtZTJjOWZiMzJjODhi")
{:ok}
Refresh for a new access_token given a refresh_token
Returns {:ok,"access_token"}
.
Examples
iex> AccessPass.refresh("ODhhMDgzYwfefdfeC00YjgyLWFiZGMtZTJjOWZiMzJjODhi")
{:ok, "ODhhMDgzYjctZTE3OC00YjgyLWFiZGMtZTJjOWZiMzJjODhi"}
Register a new user
Returns {"ok":
{
"type":"TYPE",
"refresh_token":"refresh token",
"refresh_expire_in": seconds,
"access_token":"access_token",
"access_expire_in": seconds
}
}
Examples
iex> AccessPass.register(%{
username: "example",
password: "otherexample",
email: "example@email.com",
meta: {
coolInfo: "stored in here"
}
})
{"ok":
{
"type":"basic",
"refresh_token":"MjNmYzgzNGMtMGM3MS00YTA4LTkxMWMtNDEyODU3Yzk2ZTgy",
"refresh_expire_in":1200,
"access_token":"ODhhMDgzYjctZTE3OC00YjgyLWFiZGMtZTJjOWZiMzJjODhi",
"access_expire_in":600
}
}
calling will set a reset password email to the linked email account of the username
Returns {ok: "password reset sent to accounts email"}
.
Examples
iex> AccessPass.reset_password("jordiee")
{ok: "password reset sent to accounts email"}