{"id":19645813,"url":"https://github.com/approov/quickstart-flutter-elixir-phoenix-channels","last_synced_at":"2026-03-27T04:57:41.431Z","repository":{"id":41956662,"uuid":"320270382","full_name":"approov/quickstart-flutter-elixir-phoenix-channels","owner":"approov","description":"Approov integration quickstart for mobile apps using a backend with Elixir Phoenix Channels","archived":false,"fork":false,"pushed_at":"2025-05-09T10:48:25.000Z","size":309,"stargazers_count":33,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-09T11:54:49.639Z","etag":null,"topics":["approov","approov-flutter","approov-integration","approov-mobile","approov-mobile-quickstart","approov-quickstart","flutter","flutter-security","mobile","mobile-app-security","mobile-security"],"latest_commit_sha":null,"homepage":"https://approov.io","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/approov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-10T12:47:26.000Z","updated_at":"2025-05-09T10:48:26.000Z","dependencies_parsed_at":"2023-12-22T14:34:04.571Z","dependency_job_id":"9e4691db-c35f-49de-b64c-4a588a439ce3","html_url":"https://github.com/approov/quickstart-flutter-elixir-phoenix-channels","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/approov/quickstart-flutter-elixir-phoenix-channels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approov%2Fquickstart-flutter-elixir-phoenix-channels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approov%2Fquickstart-flutter-elixir-phoenix-channels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approov%2Fquickstart-flutter-elixir-phoenix-channels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approov%2Fquickstart-flutter-elixir-phoenix-channels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/approov","download_url":"https://codeload.github.com/approov/quickstart-flutter-elixir-phoenix-channels/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approov%2Fquickstart-flutter-elixir-phoenix-channels/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006258,"owners_count":26084060,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["approov","approov-flutter","approov-integration","approov-mobile","approov-mobile-quickstart","approov-quickstart","flutter","flutter-security","mobile","mobile-app-security","mobile-security"],"created_at":"2024-11-11T14:35:28.530Z","updated_at":"2025-10-11T04:10:15.476Z","avatar_url":"https://github.com/approov.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Approov Quickstart: Flutter Elixir Phoenix Channels\n\n[Approov](https://approov.io) is an API security solution used to verify that requests received by your backend services originate from trusted versions of your mobile apps.\n\nThis is an Approov integration quickstart for Flutter and using a backend with [Elixir Phoenix Channels](https://hexdocs.pm/phoenix/channels.html). Additionally, a step-by-step tutorial guide using a [Echo Chamber App](https://github.com/approov/quickstart-flutter-elixir-phoenix-channels/blob/master/ECHO-CHAMBER-EXAMPLE.md) is also available.\n\nNote that the minimum OS requirement for iOS is 12 and for Android the minimum SDK version is 23 (Android 6.0). You cannot use Approov in apps that need to support OS versions older than this.\n\n\u003e ## ⚠️ CAUTION\n\u003e **This quickstart does not currently work with Approov integration because the packages in https://github.com/approov/approov-flutter-packages need to be updated to be compatible with Flutter 3.0 versions. Please contact Approov support if you require an updated version.**\n\n## ADDING APPROOV ENABLED ELIXIR PHOENIX CHANNELS\n\nThe Approov Enabled Elixir Phoenix Channels is available via a [`Github`](https://github.com/approov/approov-flutter-packages.git) package. This allows inclusion into the project by simply specifying a dependency in the `pubspec.yaml` files for the app. In the `dependencies:` section of `pubspec.yaml` file add the following package reference:\n\n```yaml\nphoenix_wings:\n  git:\n    url: https://github.com/approov/approov-flutter-packages.git\n    path: phoenix_wings\napproov_web_socket:\n  git:\n    url: https://github.com/approov/approov-flutter-packages.git\n    path: approov_web_socket\napproov_service_flutter_httpclient:\n  git: https://github.com/approov/approov-service-flutter-httpclient.git\n```\n\nNote that this creates a dependency on the latest version of the `approov-service-flutter-httpclient`, as do the dependencies in `approov-flutter-packages`. If you wish to create a dependency on a fixed tagged version you can use a syntax such as the following:\n\n```yaml\napproov_service_flutter_httpclient:\n  git:\n    url: https://github.com/approov/approov-service-flutter-httpclient.git\n    ref: 3.3.1\n```\n\nYou will need to fork the `approov-flutter-packages` if you wish to fix their dependency to a specific tag.\n\nThe `phoenix_wings` package uses a predefined header to forward the Approov Token and also forwards the Approov SDK initialization string to the `approov_web_socket` package. The `approov_web_socket` package interacts with the `approov_service_flutter_httpclient` by means of an `ApproovHttpClient` object.\n\nThe `approov_service_flutter_httpclient` package is actually an open source wrapper layer that allows you to easily use Approov with `Flutter`. This has a further dependency to the closed source [Android Approov SDK](https://github.com/approov/approov-android-sdk) and [iOS Approov SDK](https://github.com/approov/approov-ios-sdk) packages. Those are automatically added as dependencies for the platform specific targets.\n\nThe `approov_service_flutter_httpclient` package provides a number of accessible classes:\n\n1. `ApproovService` provides a higher level interface to the underlying Approov SDK\n2. `ApproovException`, and derived `ApproovNetworkException` and `ApproovRejectionException`, provide special exception classes for Approov related errors \n3. `ApproovHttpClient` which is a drop-in replacement for the Dart IO library's `HttpClient` and calls the `ApproovService`\n4. `ApproovClient` which is a drop-in replacement for Client from the Flutter http package (https://pub.dev/packages/http) and internally uses an `ApproovHttpClient` object\n\n### ANDROID MANIFEST CHANGES\n\nThe following app permissions need to be available in the manifest of your application to be able to use Approov:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n\u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n```\n\nPlease [read this](https://approov.io/docs/latest/approov-usage-documentation/#targetting-android-11-and-above) section of the reference documentation if targetting Android 11 (API level 30) or above.\n\n### IOS\n\nThe `approov_service_flutter_httpclient` generates a [Cocoapods](https://cocoapods.org) dependency file which must be installed by executing:\n\n```Bash\npod install\n```\n\nin the directory containing the ios project files.\n\n## USING APPROOV WITH PHOENIX CHANNELS\n\nFirst, you need to instantiate the `PhoenixSocket` with an additional parameter and use it to `connect()`:\n\n```Dart\nPhoenixSocket socket = PhoenixSocket(\"${HttpService.websocketUrl}/socket/websocket\",\n        '\u003center your config string here\u003e',\n        socketOptions: socket_options);\n```\n\nThe `\u003center-your-config-string-here\u003e` is a custom string that configures your Approov account access. This will have been provided in your Approov onboarding email.\n\nNow, you need to add the Approov token when you join to the Phoenix channel:\n\n```dart\nimport 'package:approov_service_flutter_httpclient/approov_service_flutter_httpclient.dart';\n\nMap urlParams = {\n  \"X-Approov-Token\": await ApproovService.fetchToken('your.api.domain.com')\n};\n\nfinal PhoenixChannel _channel = _socket.channel(channelName, urlParams);\n```\n\nNext, add the Approov token to the payload of each message sent to the Phoenix channel:\n\n```dart\nimport 'package:approov_service_flutter_httpclient/approov_service_flutter_httpclient.dart';\n\nMap payload = {\n  \"X-Approov-Token\": await ApproovService.fetchToken('your.api.domain.com'),\n  \"message\" : message\n};\n\n_channel.push(event: \"name\", payload: payload);\n```\n\nIt's important that you also use the Approov token when joining to the channel and when sending messages to it, because your app environment can be compromised at any moment by an attacker, and when this occurs an invalid Approov token is sent in the API request headers to allow for your backend to reject any message it receives and to not send any data back as it would normally do.\n\n## CHECKING IT WORKS\n\nInitially you won't have set which API domains to protect, so the interceptor will not add anything. It will have called Approov though and made contact with the Approov cloud service. You will see logging from Approov saying `UNKNOWN_URL`.\n\nYour Approov onboarding email should contain a link allowing you to access [Live Metrics Graphs](https://approov.io/docs/latest/approov-usage-documentation/#metrics-graphs). After you've run your app with Approov integration you should be able to see the results in the live metrics within a minute or so. At this stage you could even release your app to get details of your app population and the attributes of the devices they are running upon.\n\n## NEXT STEPS\nTo actually protect your APIs and/or secrets there are some further steps. Approov provides two different options for protection:\n\n* [API PROTECTION](https://github.com/approov/quickstart-flutter-httpclient/blob/master/API-PROTECTION.md): You should use this if you control the backend API(s) being protected and are able to modify them to ensure that a valid Approov token is being passed by the app. An [Approov Token](https://approov.io/docs/latest/approov-usage-documentation/#approov-tokens) is short lived crytographically signed JWT proving the authenticity of the call.\n\n* [SECRETS PROTECTION](https://github.com/approov/quickstart-flutter-httpclient/blob/master/SECRETS-PROTECTION.md): This allows app secrets, including API keys for 3rd party services, to be protected so that they no longer need to be included in the released app code. These secrets are only made available to valid apps at runtime.\n\nNote that it is possible to use both approaches side-by-side in the same app.\n\nSee [REFERENCE](https://github.com/approov/quickstart-flutter-httpclient/blob/master/REFERENCE.md) for a complete list of all of the `ApproovService` methods.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapproov%2Fquickstart-flutter-elixir-phoenix-channels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapproov%2Fquickstart-flutter-elixir-phoenix-channels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapproov%2Fquickstart-flutter-elixir-phoenix-channels/lists"}