Note: This repository contains the supporting project for a tutorial found on tru.ID's Developer portal.
- A tru.ID Account
- An Auth0 Account
- Ngrok
- A mobile phone with a SIM card and mobile data connection
Clone the starter-files branch via:
git clone -b starter-files --single-branch https://github.com/tru-ID/sim-based-authentication-flutter-auth0.git
If you're only interested in the finished code in main then run:
git clone -b main https://github.com/tru-ID/sim-based-authentication-flutter-auth0.git
Create a tru.ID Account
Install the tru.ID CLI via:
npm i -g @tru_id/cli
Input your tru.ID credentials which can be found within the tru.ID console
Install the tru.ID development server
Create a new tru.ID project within the root directory via:
tru projects:create flutter-auth0 --project-dir .
Run the development server, pointing it to the directory containing the newly created project configuration. This will run a local development server on port 8080
To make the development server publicly accessible on the internet, provide your Ngrok credentials in the .env
file of your dev-server
Head over to the Auth0 and sign in. When signed in you'll be redirected to the dashboard as shown below.
To create a new application by clicking on the "applications" pane on the left hand side. This will route you to a new page. Click on the "create application" button to create a new application as shown below.
This will give you Client ID
and Client Secret
values which can be found under the settings tab.
Next, we need to set up the application callback URL. In the settings page scroll to "Application URIs" and in the "Application callback URL" section enter the following:
com.truid.flutterauth0subscribercheck://login-callback
As shown below:
Next, we need to copy our the values of the .env.example
to .env
:
cp .env.example .env
Replace AUTH0_CLIENT_ID
with the Client ID
value.
Next, replace AUTH0_DOMAIN
with the Domain
value.
Update AUTH0_ISSUER
with the appropriate value.
To start the project, ensure you have a physical device connected then run:
flutter run
Note For a physical iOS device ensure you've provisioned your project in XCode