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.exsconfig/runtime.exsdeployment/index.tsfrontend/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
Credentialsfrom the left menu - Select
Create credentialsand chooseOAuth client id - (If this is your first time, it will ask your to fill in the
OAuth consent screenfirst. 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.exsfile and fill in the missinggooglefields:- 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
Authenticationand clickAdd platformand add:http://localhost:4000/api/v1/auth/azure_ad/callbackhttps://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.exsfile and fill in the missingazure_adfields:
client_idis found in your app underApplication (client) ID
- Follow the steps to Add a client secret
- In your Potionx project, navigate to the
dev.secret.exsfile and fill in the missingazure_adfields:
Client secrets(it's calledValueon Azure)
- Back in the home dashboard, select
Subscriptionsand 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 providersand search forMicrosoft.AzureActiveDirectory. Select it and pressRegisterabove the list (Microsoft instructions) - In the left menu, scroll down to
Resourcesand clickCreate resource. Search and selectAzure Active Directory B2C, and then clickCreate. - Select
Create a new Azure AD B2C Tenantand fill out the fields. ClickCreate and reviewand thenCreate. It should take a few minutes to confirm in your notifications.