Use the API from Flutter
Thethefaithapp_auth package signs a member in through TheFaithApp and gives
your Flutter app an authenticated client for v1 API requests. Your app does
not need to host a callback website.
Before you begin
You need:- a Flutter app targeting Android or iOS
- its Android application ID or iOS bundle ID
- a client API key from
Settings > Developer Access
1
Add the package
Add the package to your Install it:Stop and rebuild the app after adding the package so Flutter can register
its platform code.
pubspec.yaml:2
Register your Flutter app
In the TheFaithApp dashboard:The dashboard creates the callback expected by the package:Use a lowercase reverse-domain application ID containing letters, numbers,
and dots. Avoid underscores because they cannot be used in a callback URI
scheme.
- Open
Settings > Developer Access. - Click Add Flutter app.
- Append
.thefaithappto your application ID. - Add the app and copy your client API key.
com.example.app, enter:3
Check platform requirements
Android
- Set
minSdkto24or newer. - No manual callback activity is required.
- Set the deployment target to iOS
13.0or newer. - Enable Keychain Sharing for the Runner target in Xcode.
4
Initialize the SDK
Provide the client key when creating Pass the value from your build environment instead of committing it to the
repository:
TheFaithAppAuth:5
Sign in a member
Open hosted sign-in from a button or another user action:After the member finishes signing in, the package returns to the app and
saves the session securely.
6
Call a v1 endpoint
Use the authorized client for protected API requests:Use
auth.apiUri('/v1/...') for other endpoints in the API Reference.Restore the saved session
Check for a saved session when the app starts:currentSession() returns null, show the sign-in action again.
Sign out
Revoke the member session and remove its saved copy:Handle SDK errors
CatchTheFaithAuthException to show an appropriate message:
Troubleshooting
Next steps
- Browse the endpoint groups in the API Reference navigation.
- Read Pagination and Errors before loading lists or adding retry behavior.
- Use the public standalone sample as a compact reference implementation.