Social Login
To set up the providers of your choice from Assent, you'll need to edit config/dev.secret.exs
with the appropriate credentials. Included below are instructions for how to do this for the Google and Microsoft (Azure) platforms which are included are strategies by default.
You'll have to remove the providers you don't plan on using from:
config/dev.secret.exs
config/runtime.exs
deployment/index.ts
frontend/admin/src/routes/RouteLogin.tsx
Note: In development mode, a bypass provider is added to log in without the need for a social provider
Google's instructions can be found here
Steps:
- Log in or create an account
- Search for "create a project"
- Create a project
- Return to the main page and select
Credentials
from the left menu - Select
Create credentials
and chooseOAuth client id
- (If this is your first time, it will ask your to fill in the
OAuth consent screen
first. Select the user type (External) and clickcreate
, then repeat the previous step - Fill out the OAuth form and click create:
- Select type
- Choose a name
- Authorized Javascript origins:
http://localhost:4000
- Authorized redirect URIs:
http://localhost:4000/api/v1/auth/google/callback
- Authorized redirect URIs:
https://SUBDOMAIN_AND_DOMAIN/api/v1/auth/google/callback
Don't forget to edit your domain name in the URL provided
- In your Potionx project, navigate to the
dev.secret.exs
file and fill in the missinggoogle
fields:- client_id
- client_secret
- Save and refire
mix phx.server
Microsoft
Microsoft's instructions can be found here
Steps:
- Log in or create an account
- Follow the steps to register an application
- Select a name
- Once it is created, in the left menu select
Authentication
and clickAdd platform
and add:http://localhost:4000/api/v1/auth/azure_ad/callback
https://SUBDOMAIN_AND_DOMAIN/api/v1/auth/azure_ad/callback
Don't forget to edit your domain name in the URL provided
- In your Potionx project, navigate to the
dev.secret.exs
file and fill in the missingazure_ad
fields:
client_id
is found in your app underApplication (client) ID
- Follow the steps to Add a client secret
- In your Potionx project, navigate to the
dev.secret.exs
file and fill in the missingazure_ad
fields:
Client secrets
(it's calledValue
on Azure)
- Back in the home dashboard, select
Subscriptions
and select your current subscription (You'll need to set one up if you do not currently have one on your live account) - In the left menu, scroll down to
Resource providers
and search forMicrosoft.AzureActiveDirectory
. Select it and pressRegister
above the list (Microsoft instructions) - In the left menu, scroll down to
Resources
and clickCreate resource
. Search and selectAzure Active Directory B2C
, and then clickCreate
. - Select
Create a new Azure AD B2C Tenant
and fill out the fields. ClickCreate and review
and thenCreate
. It should take a few minutes to confirm in your notifications.