plug_mishka_auth v0.0.2 MishkaAuth.Client.Helper.HandleSocialRequest View Source

Link to this section Summary

Functions

creates an Identity data map and saves after finding user but there is not an Identity for this provider concerned

main function which helps us to call back router and handle social request. is there a user we want ro create. register or sign in

if user email exist or not this function helps to update Identity or save data on temporary redis table

this function checks your databse if user email exist or not

if there are errors after returning social provider, this function create a list of errors

get basic data after sending provider output to callback router

update an Identity data map and edit after finding user, there is an Identity for this provider concerned

Link to this section Types

Specs

conn() :: Plug.Conn.t()

Specs

provider() :: atom() | String.t()

Specs

social_uid() :: String.t() | integer()

Specs

strategy_type() :: atom()
Link to this type

temporary_user_uniq_id()

View Source

Specs

temporary_user_uniq_id() :: String.t()

Specs

token() :: String.t()

Link to this section Functions

Link to this function

add_user_identity(exist_user, provider, uid, token)

View Source

Specs

add_user_identity(Ecto.Schema.t(), provider(), social_uid(), token()) ::
  {:ok, :add_identity, Ecto.Schema.t()}
  | {:error, :add_identity, Ecto.Changeset.t()}

creates an Identity data map and saves after finding user but there is not an Identity for this provider concerned

Link to this function

back_request(auth, atom, temporary_user_uniq_id, strategy_type, conn)

View Source

Specs

back_request(
  %Ueberauth.Auth{
    credentials: term(),
    extra: term(),
    info: term(),
    provider: term(),
    strategy: term(),
    uid: term()
  }
  | %Ueberauth.Failure{errors: term(), provider: term(), strategy: term()},
  atom(),
  temporary_user_uniq_id(),
  strategy_type(),
  Plug.Conn.t()
) ::
  {:ok, :config_user_social_data, :exist_user, token(), token()}
  | {:ok, :config_user_social_data, :none_user, temporary_user_uniq_id()}
  | {:error, :get_basic_data, any()}
  | {:error, :config_user_social_data, :exist_user | :none_user}
  | Plug.Conn.t()

main function which helps us to call back router and handle social request. is there a user we want ro create. register or sign in

Link to this function

config_user_social_data(arg1, strategy_type, conn)

View Source

Specs

config_user_social_data(
  {:ok, :edit_identity, Ecto.Schema.t()}
  | {:ok, :add_identity, Ecto.Schema.t()}
  | {:ok, :create_or_update_user, :save_temporary_social_data,
     temporary_user_uniq_id()},
  strategy_type(),
  conn()
) :: Plug.Conn.t()
Link to this function

create_or_update_user(arg, provider, token, temporary_user_uniq_id)

View Source

Specs

create_or_update_user(
  {:does_user_email_exist?, {:error, :find_user_with_email}, map(), String.t()}
  | {:does_user_email_exist?, {:ok, :find_user_with_email, Ecto.Schema.t()},
     map(), String.t()},
  atom(),
  token(),
  temporary_user_uniq_id()
) ::
  {:ok, :create_or_update_user, :save_temporary_social_data,
   temporary_user_uniq_id()}
  | {:ok, :add_identity | :edit_identity, Ecto.Schema.t()}

if user email exist or not this function helps to update Identity or save data on temporary redis table

Link to this function

does_user_email_exist?(arg)

View Source

Specs

does_user_email_exist?({:ok, :get_basic_data, map(), String.t()}) ::
  {:does_user_email_exist?, {:error, :find_user_with_email}, map(), String.t()}
  | {:does_user_email_exist?, {:ok, :find_user_with_email, Ecto.Schema.t()},
     map(), String.t()}
  | {:error, :get_basic_data, any()}

this function checks your databse if user email exist or not

Specs

error_getter(any()) :: [any()]

if there are errors after returning social provider, this function create a list of errors

Link to this function

get_basic_data(user_info, provider, uid)

View Source

Specs

get_basic_data(
  %Ueberauth.Auth.Info{
    birthday: term(),
    description: term(),
    email: term(),
    first_name: term(),
    image: term(),
    last_name: term(),
    location: term(),
    name: term(),
    nickname: term(),
    phone: term(),
    urls: term()
  },
  atom(),
  integer() | float() | String.t()
) :: {:ok, :get_basic_data, map(), String.t()}

get basic data after sending provider output to callback router

Link to this function

update_user_identity(exist_user, uid, identity, token)

View Source

Specs

update_user_identity(Ecto.Schema.t(), social_uid(), Ecto.Schema.t(), token()) ::
  {:ok, :edit_identity, Ecto.Schema.t()}

update an Identity data map and edit after finding user, there is an Identity for this provider concerned