Install the CAWS Client
-
You need a CARP Web Service (CAWS) host running. See the CARP Web Service GitHub repro and documentation for how to do this. If you’re part of the CARP team, you can use the specified test, staging, and production servers.
-
Add
carp_servicesas a dependency in your pubspec.yaml file.
This package uses the oidc plugin for authentication. Please follow their getting started guide and take a look at their example app.
Android
Section titled “Android”On Android you need to edit both the build.gradle file and the AndroidManifest.xml file plus disable some backup settings.
You also need to add an activity to the AndroidManifest.xml to allow for redirection to/from the web view for authentication (if you are using the authenticate() or authenticateWithMagicLink methods in the package). You manifest file would look something like this:
...
<application android:name="${applicationName}" android:label="CAWS Example" android:icon="@mipmap/ic_launcher">
<!-- Used by authentication redirect to/from web view --><activity android:name="net.openid.appauth.RedirectUriReceiverActivity" android:theme="@style/Theme.AppCompat.NoActionBar" android:exported="true" tools:node="replace"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="carp-studies-auth" android:pathPrefix="/auth" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:host="carp.computerome.dk" /> <data android:pathPrefix="/auth" /> </intent-filter></activity>
<!-- Used by authentication redirect to/from web view for anonymous users --><activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true"> <intent-filter android:label="flutter_web_auth_2"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="caws-example-app" android:pathPrefix="/" /> </intent-filter></activity> </application>Add the following CFBundleURLTypes entry in your Info.plist file:
<plist version="1.0"><dict> ... <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>com.my.app</string> <string>my-redirect-uri</string> </array> </dict> </array></dict></plist>Replace com.my.app with your application id and my-redirect-url with your redirect uri.