View Source AshAuthentication.Firebase

Hex.pm Hex.pm

Firebase token authentication strategy for AshAuthentication.

🛠 In development. Use at your own risk.

Installation

The package can be installed by adding ash_authentication_firebase to your list of dependencies in mix.exs:

def deps do
  [
    {:ash_authentication_firebase, "~> 0.1.0"}
  ]
end

Usage

Please consult with official Ash documentation on how to create your resource.

Add AshAuthentication.Strategy.Firebase to your resource extensions list and :firebase strategy to the authentication section:

defmodule MyApp.Accounts.User do
  use Ash.Resource,
    extensions: [AshAuthentication, AshAuthentication.Strategy.Firebase]

...

  authentication do
    api MyApp.Accounts

    strategies do
      # You can have multiple firebase strategies
      firebase :firebase_main do
        project_id Application.fetch_env!(:your_app, __MODULE__)[:firebase_project_id]
        token_input :firebase_token
      end

      firebase :firebase_secondary do
        project_id "project-123abc"
        token_input :firebase_token
      end
    end
  end

...

end