├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yaml │ ├── compatibility-issue.md │ └── feature_request.md └── workflows │ └── ci.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── analysis_options.yaml ├── flutter_web_auth_2 ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── com │ │ └── linusu │ │ └── flutter_web_auth_2 │ │ ├── AuthenticationManagementActivity.kt │ │ ├── CallbackActivity.kt │ │ ├── FlutterWebAuth2Plugin.kt │ │ ├── KeepAliveService.kt │ │ ├── TabBuilderWrapper.kt │ │ └── Utils.kt ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ │ ├── .project │ │ ├── .settings │ │ │ └── org.eclipse.buildship.core.prefs │ │ ├── app │ │ │ ├── .classpath │ │ │ ├── .project │ │ │ ├── .settings │ │ │ │ └── org.eclipse.buildship.core.prefs │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── linusu │ │ │ │ │ │ └── flutter_web_auth_2_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ ├── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ └── LaunchImage.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ │ └── RunnerTests │ │ │ └── RunnerTests.swift │ ├── lib │ │ └── main.dart │ ├── linux │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ │ ├── CMakeLists.txt │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugin_registrant.h │ │ │ └── generated_plugins.cmake │ │ ├── main.cc │ │ ├── my_application.cc │ │ └── my_application.h │ ├── macos │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ └── app_icon_64.png │ │ │ ├── Base.lproj │ │ │ │ └── MainMenu.xib │ │ │ ├── Configs │ │ │ │ ├── AppInfo.xcconfig │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ └── Warnings.xcconfig │ │ │ ├── DebugProfile.entitlements │ │ │ ├── Info.plist │ │ │ ├── MainFlutterWindow.swift │ │ │ └── Release.entitlements │ │ └── RunnerTests │ │ │ └── RunnerTests.swift │ ├── pubspec.yaml │ ├── test │ │ └── widget_test.dart │ ├── web │ │ ├── auth.html │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── Icon-192.png │ │ │ ├── Icon-512.png │ │ │ ├── Icon-maskable-192.png │ │ │ └── Icon-maskable-512.png │ │ ├── index.html │ │ └── manifest.json │ └── windows │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ │ └── runner │ │ ├── CMakeLists.txt │ │ ├── Runner.rc │ │ ├── flutter_window.cpp │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── resource.h │ │ ├── resources │ │ └── app_icon.ico │ │ ├── runner.exe.manifest │ │ ├── utils.cpp │ │ ├── utils.h │ │ ├── win32_window.cpp │ │ └── win32_window.h ├── ios │ ├── .gitignore │ ├── flutter_web_auth_2.podspec │ └── flutter_web_auth_2 │ │ ├── Package.swift │ │ └── Sources │ │ └── flutter_web_auth_2 │ │ └── FlutterWebAuth2Plugin.swift ├── lib │ ├── flutter_web_auth_2.dart │ └── src │ │ ├── linows.dart │ │ ├── macos.dart │ │ ├── options.dart │ │ ├── platform │ │ ├── platform_is.dart │ │ ├── universal_platform_none.dart │ │ ├── universal_platform_vm.dart │ │ └── universal_platform_web.dart │ │ ├── server.dart │ │ ├── unsupported.dart │ │ ├── web.dart │ │ └── webview.dart ├── macos │ ├── .gitignore │ ├── flutter_web_auth_2.podspec │ └── flutter_web_auth_2 │ │ ├── Package.swift │ │ └── Sources │ │ └── flutter_web_auth_2 │ │ └── FlutterWebAuth2Plugin.swift ├── pubspec.yaml ├── screen-android.gif ├── screen-ios.gif ├── screen-macos.gif └── test │ └── flutter_web_auth_2_test.dart ├── flutter_web_auth_2_platform_interface ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example │ └── main.dart ├── lib │ ├── flutter_web_auth_2_platform_interface.dart │ └── method_channel │ │ └── method_channel.dart ├── pubspec.yaml └── test │ └── flutter_web_auth_platform_interface_test.dart └── pubspec.yaml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: ThexXTURBOXx 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yaml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Create a bug report to help us improve 3 | title: '[Bug]: ' 4 | labels: 5 | - bug 6 | assignees: 7 | - ThexXTURBOXx 8 | body: 9 | - type: textarea 10 | attributes: 11 | label: Description 12 | description: A clear and concise description of the problem 13 | placeholder: Currently, I am trying to [...] 14 | validations: 15 | required: true 16 | - type: textarea 17 | attributes: 18 | label: Minimal Reproduction 19 | description: Provide steps to reproduce the problem 20 | placeholder: 'Steps to reproduce the behaviour: [...]' 21 | value: |- 22 | Steps to reproduce the behaviour: 23 | 24 | 1. Use the following code: 25 | ```dart 26 | 27 | ``` 28 | 2. [...] 29 | validations: 30 | required: true 31 | - type: textarea 32 | attributes: 33 | label: Exception or Error 34 | description: Provide error logs 35 | placeholder: Copy paste from the log/console 36 | validations: 37 | required: true 38 | - type: textarea 39 | attributes: 40 | label: Expected Behaviour 41 | description: A clear and concise description of what you expected to happen 42 | placeholder: The package should [...] 43 | validations: 44 | required: true 45 | - type: textarea 46 | attributes: 47 | label: Screenshots 48 | description: If applicable, add screenshots to help explain your problem 49 | placeholder: You can upload screenshots by drag’n’drop 50 | - type: textarea 51 | attributes: 52 | label: Additional context 53 | description: Add any other context about the problem here 54 | - type: markdown 55 | attributes: 56 | value: '# Environment' 57 | - type: input 58 | attributes: 59 | label: Device 60 | placeholder: e.g. iPhone 6, Desktop Computer 61 | validations: 62 | required: true 63 | - type: input 64 | attributes: 65 | label: OS 66 | placeholder: e.g. iOS 8.1, Windows 10 21H2 67 | validations: 68 | required: true 69 | - type: input 70 | attributes: 71 | label: Browser 72 | placeholder: e.g. Stock, Chrome, Safari, Firefox 73 | validations: 74 | required: true 75 | - type: input 76 | attributes: 77 | label: Flutter version 78 | placeholder: e.g. 3.13.9 79 | validations: 80 | required: true 81 | - type: input 82 | attributes: 83 | label: flutter_web_auth_2 version 84 | placeholder: e.g. 3.0.3 85 | validations: 86 | required: true 87 | - type: checkboxes 88 | attributes: 89 | label: Checklist 90 | options: 91 | - label: >- 92 | I have read and followed the **entire** [troubleshooting 93 | guide](https://github.com/ThexXTURBOXx/flutter_web_auth_2#troubleshooting) 94 | and it has not provided the solution I need. 95 | required: true 96 | - label: I have provided all the information I can. 97 | required: true 98 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/compatibility-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Compatibility issue 3 | about: Something is not compatible with the original flutter_web_auth plugin? 4 | title: '' 5 | labels: compatibility 6 | assignees: ThexXTURBOXx 7 | 8 | --- 9 | 10 | ## Description 11 | A clear and concise description of what the issue is. 12 | 13 | ## To Reproduce 14 | ```dart 15 | Code to reproduce the behavior 16 | ``` 17 | 18 | ## Expected behavior 19 | A clear and concise description of what you expected to happen. 20 | 21 | ## Screenshots 22 | If applicable, add screenshots to help explain your problem. 23 | 24 | ## Device (please complete the following information!) 25 | - Device: [e.g. iPhone 6, Desktop Computer] 26 | - OS: [e.g. iOS 8.1, Windows 10 21H2] 27 | - Browser: [e.g. Stock, Chrome, Safari, Firefox] 28 | - `flutter_web_auth_2` version: [e.g. 1.1.1] 29 | 30 | ## Additional context 31 | Add any other context about the problem here. 32 | 33 | ## Checklist 34 | - [ ] I have read and followed the **entire** [troubleshooting guide](https://github.com/ThexXTURBOXx/flutter_web_auth_2#troubleshooting) and it has not provided the solution I need. 35 | - [ ] I have provided all the information I can (incl. auth URL etc.) 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: ThexXTURBOXx 7 | 8 | --- 9 | 10 | ## Is your feature request related to a problem? Please describe. 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | ## Describe the solution you'd like 14 | A clear and concise description of what you want to happen. 15 | 16 | ## Describe alternatives you've considered 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | ## Additional context 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | lint: 10 | name: Lint 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v5 15 | 16 | - name: Install Flutter 17 | uses: subosito/flutter-action@v2 18 | with: 19 | channel: 'stable' 20 | 21 | - name: Install melos and initialize workspace 22 | uses: bluefireteam/melos-action@v3 23 | 24 | - name: Lint 25 | run: melos format --output none --set-exit-if-changed 26 | 27 | - name: Analyze 28 | run: flutter analyze 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .gradle/ 10 | .history 11 | .svn/ 12 | migrate_working_dir/ 13 | 14 | # IntelliJ related 15 | *.iml 16 | *.ipr 17 | *.iws 18 | .idea/ 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | #.vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 27 | pubspec.lock 28 | pubspec_overrides.yaml 29 | **/doc/api/ 30 | **/ios/Flutter/.last_build_id 31 | .dart_tool/ 32 | .flutter-plugins 33 | .flutter-plugins-dependencies 34 | .packages 35 | .pub-cache/ 36 | .pub/ 37 | /build/ 38 | 39 | # Symbolication related 40 | app.*.symbols 41 | 42 | # Obfuscation related 43 | app.*.map.json 44 | 45 | # Android Studio will place build artifacts here 46 | /android/app/debug 47 | /android/app/profile 48 | /android/app/release 49 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for considering contributing to `flutter_web_auth_2`! We appreciate your time and effort. To maintain a healthy and collaborative open-source community, please follow the guidelines outlined in this document. 4 | 5 | ## Table of Contents 6 | 7 | - [How to Contribute](#how-to-contribute) 8 | - [Setting Up the Development Environment](#setting-up-the-development-environment) 9 | - [Making Changes](#making-changes) 10 | - [Documentation](#documentation) 11 | - [Pull Requests](#pull-requests) 12 | - [License](#license) 13 | 14 | ## How to Contribute 15 | 16 | ### Setting Up the Development Environment 17 | 18 | 1. Fork the repository and clone it to your local machine: 19 | 20 | ```bash 21 | git clone https://github.com/ThexXTURBOXx/flutter_web_auth_2.git 22 | ``` 23 | 24 | 2. Navigate to the project directory: 25 | 26 | ```bash 27 | cd flutter_web_auth_2 28 | ``` 29 | 30 | 3. Install project dependencies: 31 | 32 | ```bash 33 | melos bootstrap 34 | ``` 35 | 36 | ### Making Changes 37 | 38 | 1. Create a new branch for your feature or bug fix: 39 | 40 | ```bash 41 | git checkout -b feature-name 42 | ``` 43 | 44 | 2. Make your changes and ensure that your code follows the project's coding style. 45 | 46 | ### Documentation 47 | 48 | 1. Update the documentation to reflect your changes. 49 | 50 | 2. If you're adding a new feature, make sure to include relevant information in the documentation. 51 | 52 | ### Pull Requests 53 | 54 | 1. Commit your changes and push the branch to your fork: 55 | 56 | ```bash 57 | git add . 58 | git commit -m "Your descriptive commit message" 59 | git push origin feature-name 60 | ``` 61 | 62 | 2. [Open a pull request](https://github.com/ThexXTURBOXx/flutter_web_auth_2/compare) against the `main` branch of the original repository. 63 | 64 | 3. Clearly describe your changes in the pull request, including any motivation and context. 65 | 66 | 4. Your pull request will be reviewed by maintainers, and additional changes may be requested. 67 | 68 | ## License 69 | 70 | By contributing to `flutter_web_auth_2`, you agree that your contributions will be licensed under the project's [MIT License](LICENSE). 71 | 72 | Happy coding! 73 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Linus Unnebäck 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | flutter_web_auth_2/README.md -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Only the newest version, as indicated [here](https://pub.dev/packages/flutter_web_auth_2/versions) is supported. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | You can report a vulnerability using my contact information from [here](https://nmexis.me/). 10 | 11 | If you have reported a vulnerability, I should usually respond within a day. 12 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .gradle/ 10 | .history 11 | .svn/ 12 | migrate_working_dir/ 13 | 14 | # IntelliJ related 15 | *.iml 16 | *.ipr 17 | *.iws 18 | .idea/ 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | #.vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 27 | pubspec.lock 28 | pubspec_overrides.yaml 29 | **/doc/api/ 30 | **/ios/Flutter/.last_build_id 31 | .dart_tool/ 32 | .flutter-plugins 33 | .flutter-plugins-dependencies 34 | .packages 35 | .pub-cache/ 36 | .pub/ 37 | /build/ 38 | 39 | # Symbolication related 40 | app.*.symbols 41 | 42 | # Obfuscation related 43 | app.*.map.json 44 | 45 | # Android Studio will place build artifacts here 46 | /android/app/debug 47 | /android/app/profile 48 | /android/app/release 49 | -------------------------------------------------------------------------------- /flutter_web_auth_2/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "e1e47221e86272429674bec4f1bd36acc4fc7b77" 8 | channel: "stable" 9 | 10 | project_type: plugin 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 17 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 18 | - platform: android 19 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 20 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 21 | - platform: ios 22 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 23 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 24 | - platform: linux 25 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 26 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 27 | - platform: macos 28 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 29 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 30 | - platform: windows 31 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 32 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77 33 | 34 | # User provided section 35 | 36 | # List of Local paths (relative to this file) that should be 37 | # ignored by the migrate tool. 38 | # 39 | # Files that are not part of the templates will be ignored by default. 40 | unmanaged_files: 41 | - 'lib/main.dart' 42 | - 'ios/Runner.xcodeproj/project.pbxproj' 43 | -------------------------------------------------------------------------------- /flutter_web_auth_2/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Linus Unnebäck 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /flutter_web_auth_2/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .cxx 10 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | flutter_web_auth_2 4 | Project flutter_web_auth_2 created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=../example/android 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/build.gradle: -------------------------------------------------------------------------------- 1 | group = 'com.linusu.flutter_web_auth_2' 2 | version = '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '2.1.0' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:8.13.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdk = 36 29 | 30 | if (project.android.hasProperty("namespace")) { 31 | namespace = 'com.linusu.flutter_web_auth_2' 32 | } 33 | 34 | compileOptions { 35 | sourceCompatibility = JavaVersion.VERSION_11 36 | targetCompatibility = JavaVersion.VERSION_11 37 | } 38 | 39 | kotlinOptions { 40 | jvmTarget = 11 41 | } 42 | 43 | sourceSets { 44 | main.java.srcDirs += 'src/main/kotlin' 45 | } 46 | 47 | defaultConfig { 48 | minSdk = 21 49 | } 50 | 51 | dependencies { 52 | implementation 'androidx.browser:browser:1.9.0' 53 | implementation 'androidx.activity:activity-ktx:1.10.1' 54 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /flutter_web_auth_2/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_web_auth_2' 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/CallbackActivity.kt: -------------------------------------------------------------------------------- 1 | package com.linusu.flutter_web_auth_2 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.net.Uri 6 | import android.os.Bundle 7 | 8 | class CallbackActivity : Activity() { 9 | 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | 13 | val url = intent?.data ?: fixAutoVerifyNotWorks(intent) 14 | val scheme = url?.scheme 15 | 16 | if (scheme != null) { 17 | FlutterWebAuth2Plugin.callbacks.remove(scheme)?.success(url.toString()) 18 | } 19 | startActivity(AuthenticationManagementActivity.createResponseHandlingIntent(this)) 20 | finish() 21 | } 22 | 23 | 24 | /** Fix sometimes android:autoVerify="true" cannot works when it can't access Google after installation. 25 | * See https://stackoverflow.com/questions/76383106/auto-verify-not-always-working-in-app-links-using-android 26 | * 27 | * must register in AndroidManifest.xml : 28 | * 29 | * 30 | * 31 | * 32 | * 33 | */ 34 | private fun fixAutoVerifyNotWorks(intent: Intent?): Uri? { 35 | if (intent?.action == Intent.ACTION_SEND && "text/plain" == intent.type) { 36 | return intent.getStringExtra(Intent.EXTRA_TEXT)?.let { 37 | try { 38 | //scheme://host/path#id_token=xxx 39 | return Uri.parse(it) 40 | } catch (e: Exception) { 41 | return null 42 | } 43 | } 44 | } 45 | return null 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/KeepAliveService.kt: -------------------------------------------------------------------------------- 1 | package com.linusu.flutter_web_auth_2 2 | 3 | import android.app.Service 4 | import android.content.Intent 5 | import android.os.Binder 6 | import android.os.IBinder 7 | 8 | class KeepAliveService: Service() { 9 | companion object { 10 | val binder = Binder() 11 | } 12 | 13 | override fun onBind(intent: Intent): IBinder { 14 | return binder 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/TabBuilderWrapper.kt: -------------------------------------------------------------------------------- 1 | package com.linusu.flutter_web_auth_2 2 | 3 | import android.annotation.SuppressLint 4 | import android.app.Activity 5 | import android.content.Intent 6 | import android.net.Uri 7 | import androidx.activity.result.ActivityResultLauncher 8 | import androidx.browser.auth.AuthTabIntent 9 | import androidx.browser.customtabs.CustomTabsIntent 10 | 11 | interface TabBuilderWrapper { 12 | fun setEphemeralBrowsingEnabled(enabled: Boolean): TabBuilderWrapper 13 | fun build(): IntentWrapper 14 | } 15 | 16 | interface IntentWrapper { 17 | val intent: Intent 18 | fun launch(activity: Activity, launcher: ActivityResultLauncher, url: Uri, redirectHost: String, redirectPath: String) 19 | fun launch(activity: Activity, launcher: ActivityResultLauncher, url: Uri, redirectScheme: String) 20 | } 21 | 22 | @SuppressLint("UnsafeOptInUsageError", "UnsafeOptInUsageWarning") 23 | class CtBuilderWrapper(private val b: CustomTabsIntent.Builder) : TabBuilderWrapper { 24 | override fun setEphemeralBrowsingEnabled(enabled: Boolean) = apply { b.setEphemeralBrowsingEnabled(enabled) } 25 | 26 | override fun build(): IntentWrapper { 27 | val intent = b.build() 28 | return object : IntentWrapper { 29 | 30 | override val intent: Intent 31 | get() = intent.intent 32 | 33 | override fun launch(activity: Activity, launcher: ActivityResultLauncher, url: Uri, redirectHost: String, redirectPath: String) { 34 | intent.launchUrl(activity, url) 35 | } 36 | 37 | override fun launch(activity: Activity, launcher: ActivityResultLauncher, url: Uri, redirectScheme: String) { 38 | intent.launchUrl(activity, url) 39 | } 40 | } 41 | } 42 | } 43 | 44 | @SuppressLint("UnsafeOptInUsageError", "UnsafeOptInUsageWarning") 45 | class AuthTabBuilderWrapper(private val b: AuthTabIntent.Builder) : TabBuilderWrapper { 46 | 47 | override fun setEphemeralBrowsingEnabled(enabled: Boolean) = apply { b.setEphemeralBrowsingEnabled(enabled) } 48 | 49 | override fun build(): IntentWrapper { 50 | val intent = b.build() 51 | return object : IntentWrapper { 52 | 53 | override val intent: Intent 54 | get() = intent.intent 55 | 56 | override fun launch(activity: Activity, launcher: ActivityResultLauncher, url: Uri, redirectHost: String, redirectPath: String) { 57 | intent.launch(launcher, url, redirectHost, redirectPath) 58 | } 59 | 60 | override fun launch(activity: Activity, launcher: ActivityResultLauncher, url: Uri, redirectScheme: String) { 61 | intent.launch(launcher, url, redirectScheme) 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /flutter_web_auth_2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/Utils.kt: -------------------------------------------------------------------------------- 1 | package com.linusu.flutter_web_auth_2 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.content.pm.PackageManager 6 | import android.os.Build 7 | 8 | object PackageNames { 9 | const val CHROME_STABLE = "com.android.chrome" 10 | const val CHROME_BETA = "com.chrome.beta" 11 | const val CHROME_DEV = "com.chrome.dev" 12 | const val MICROSOFT_EDGE = "com.microsoft.emmx" 13 | const val FIREFOX = "org.mozilla.firefox" 14 | const val SAMSUNG_INTERNET = "com.sec.android.app.sbrowser" 15 | } 16 | 17 | val Any.LOG_TAG: String 18 | get() = "flutter_web_auth_2" 19 | 20 | fun Context.getInstalledVersion(packageName: String): String? { 21 | try { 22 | val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { 23 | packageManager.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(0)) 24 | } else { 25 | @Suppress("DEPRECATION") 26 | packageManager.getPackageInfo(packageName, 0) 27 | } 28 | return packageInfo.versionName 29 | } catch (_: Exception) { 30 | return null 31 | } 32 | } 33 | 34 | fun Context.getPackagesForIntent(intent: Intent): List { 35 | try { 36 | val list = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 37 | packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL) 38 | } else { 39 | packageManager.queryIntentActivities(intent, 0) 40 | } 41 | return list.map { it.activityInfo.packageName } 42 | } catch (_: Exception) { 43 | return emptyList() 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .flutter-plugins-dependencies 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | flutter_*.png 31 | linked_*.ds 32 | unlinked.ds 33 | unlinked_spec.ds 34 | 35 | # Android related 36 | **/android/app/.cxx/ 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/ServiceDefinitions.json 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 17 | base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 18 | - platform: macos 19 | create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 20 | base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_web_auth_2_example 2 | 3 | Demonstrates how to use the flutter_web_auth_2 plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir= 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=.. 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | compileSdk 36 27 | namespace = 'com.linusu.flutter_web_auth_2_example' 28 | 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_11 31 | targetCompatibility JavaVersion.VERSION_11 32 | } 33 | 34 | kotlinOptions { 35 | jvmTarget = 11 36 | } 37 | 38 | sourceSets { 39 | main.java.srcDirs += 'src/main/kotlin' 40 | } 41 | 42 | lintOptions { 43 | disable 'InvalidPackage' 44 | } 45 | 46 | defaultConfig { 47 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 48 | applicationId "com.linusu.flutter_web_auth_2_example" 49 | minSdkVersion flutter.minSdkVersion 50 | targetSdk 36 51 | versionCode flutterVersionCode.toInteger() 52 | versionName flutterVersionName 53 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig = signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source = '../..' 67 | } 68 | 69 | dependencies { 70 | } 71 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 22 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/kotlin/com/linusu/flutter_web_auth_2_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.linusu.flutter_web_auth_2_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.13.0" apply false 22 | id "org.jetbrains.kotlin.android" version "2.1.0" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | 4 | DEPENDENCIES: 5 | - Flutter (from `Flutter`) 6 | 7 | EXTERNAL SOURCES: 8 | Flutter: 9 | :path: Flutter 10 | 11 | SPEC CHECKSUMS: 12 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 13 | 14 | PODFILE CHECKSUM: 89c2d0a48e0e7e579b0121755579dbc730757d4e 15 | 16 | COCOAPODS: 1.16.2 17 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 11 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 55 | 56 | 57 | 58 | 61 | 67 | 68 | 69 | 70 | 71 | 82 | 84 | 90 | 91 | 92 | 93 | 99 | 101 | 107 | 108 | 109 | 110 | 112 | 113 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io' show HttpServer; 3 | 4 | import 'package:desktop_webview_window/desktop_webview_window.dart'; 5 | import 'package:flutter/foundation.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter/services.dart'; 8 | import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 9 | 10 | const _html = ''' 11 | 12 | 13 | 14 | 15 | Grant Access to Flutter 16 | 17 | 56 | 57 | 58 |
59 |
🏇
60 |
Press the button below to sign in using your localhost account.
61 | 62 |
63 | 64 | 65 | '''; 66 | 67 | void main(List args) { 68 | if (runWebViewTitleBarWidget(args)) { 69 | return; 70 | } 71 | runApp(const MyApp()); 72 | } 73 | 74 | class MyApp extends StatefulWidget { 75 | const MyApp({super.key}); 76 | 77 | @override 78 | MyAppState createState() => MyAppState(); 79 | } 80 | 81 | class MyAppState extends State { 82 | String _status = ''; 83 | 84 | @override 85 | void initState() { 86 | super.initState(); 87 | if (!kIsWeb) { 88 | startServer(); 89 | } 90 | } 91 | 92 | Future startServer() async { 93 | final server = await HttpServer.bind('127.0.0.1', 43823); 94 | 95 | server.listen((req) async { 96 | setState(() { 97 | _status = 'Received request!'; 98 | }); 99 | 100 | req.response.headers.add('Content-Type', 'text/html'); 101 | 102 | req.response.write( 103 | _html.replaceFirst( 104 | 'CALLBACK_URL_HERE', 105 | 'foobar://success?code=1337', 106 | ), 107 | ); 108 | 109 | await req.response.close(); 110 | }); 111 | } 112 | 113 | Future authenticate() async { 114 | setState(() { 115 | _status = ''; 116 | }); 117 | 118 | // Normally, you don't need to specify a custom URL on web. However, in 119 | // this example, we just go the auth page directly since we cannot start 120 | // the socket server... 121 | final url = kIsWeb ? '${Uri.base}auth.html' : 'http://127.0.0.1:43823/'; 122 | 123 | try { 124 | final result = await FlutterWebAuth2.authenticate( 125 | url: url, 126 | callbackUrlScheme: 'foobar', 127 | options: const FlutterWebAuth2Options( 128 | timeout: 5, // example: 5 seconds timeout 129 | //Set Android Browser priority 130 | // customTabsPackageOrder: ['com.android.chrome'], 131 | ), 132 | ); 133 | setState(() { 134 | _status = 'Got result: $result'; 135 | }); 136 | } on PlatformException catch (e) { 137 | setState(() { 138 | _status = 'Got error: $e'; 139 | }); 140 | } 141 | } 142 | 143 | @override 144 | Widget build(BuildContext context) => MaterialApp( 145 | home: Scaffold( 146 | appBar: AppBar( 147 | title: const Text('Web Auth 2 example'), 148 | ), 149 | body: Center( 150 | child: Column( 151 | mainAxisAlignment: MainAxisAlignment.center, 152 | children: [ 153 | Text('Status: $_status\n'), 154 | const SizedBox(height: 80), 155 | ElevatedButton( 156 | onPressed: () async { 157 | await authenticate(); 158 | }, 159 | child: const Text('Authenticate'), 160 | ), 161 | ], 162 | ), 163 | ), 164 | ), 165 | ); 166 | } 167 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.linusu.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void fl_register_plugins(FlPluginRegistry* registry) { 14 | g_autoptr(FlPluginRegistrar) desktop_webview_window_registrar = 15 | fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewWindowPlugin"); 16 | desktop_webview_window_plugin_register_with_registrar(desktop_webview_window_registrar); 17 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 18 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 19 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 20 | g_autoptr(FlPluginRegistrar) window_to_front_registrar = 21 | fl_plugin_registry_get_registrar_for_plugin(registry, "WindowToFrontPlugin"); 22 | window_to_front_plugin_register_with_registrar(window_to_front_registrar); 23 | } 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | desktop_webview_window 7 | url_launcher_linux 8 | window_to_front 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import desktop_webview_window 9 | import flutter_web_auth_2 10 | import path_provider_foundation 11 | import url_launcher_macos 12 | import window_to_front 13 | 14 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 15 | DesktopWebviewWindowPlugin.register(with: registry.registrar(forPlugin: "DesktopWebviewWindowPlugin")) 16 | FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) 17 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 18 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 19 | WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin")) 20 | } 21 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.15' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - desktop_webview_window (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - window_to_front (0.0.1): 6 | - FlutterMacOS 7 | 8 | DEPENDENCIES: 9 | - desktop_webview_window (from `Flutter/ephemeral/.symlinks/plugins/desktop_webview_window/macos`) 10 | - FlutterMacOS (from `Flutter/ephemeral`) 11 | - window_to_front (from `Flutter/ephemeral/.symlinks/plugins/window_to_front/macos`) 12 | 13 | EXTERNAL SOURCES: 14 | desktop_webview_window: 15 | :path: Flutter/ephemeral/.symlinks/plugins/desktop_webview_window/macos 16 | FlutterMacOS: 17 | :path: Flutter/ephemeral 18 | window_to_front: 19 | :path: Flutter/ephemeral/.symlinks/plugins/window_to_front/macos 20 | 21 | SPEC CHECKSUMS: 22 | desktop_webview_window: 7e37af677d6d19294cb433d9b1d878ef78dffa4d 23 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 24 | window_to_front: 9e76fd432e36700a197dac86a0011e49c89abe0a 25 | 26 | PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3 27 | 28 | COCOAPODS: 1.16.2 29 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 11 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 55 | 56 | 57 | 58 | 61 | 67 | 68 | 69 | 70 | 71 | 82 | 84 | 90 | 91 | 92 | 93 | 99 | 101 | 107 | 108 | 109 | 110 | 112 | 113 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = flutter_web_auth_2_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.linusu.flutterWebAuth2Example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.linusu. All rights reserved. 15 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_web_auth_2_example 2 | description: Demonstrates how to use the flutter_web_auth_2 plugin. 3 | version: 1.0.0+1 4 | resolution: workspace 5 | publish_to: 'none' 6 | 7 | environment: 8 | sdk: ">=3.5.0 <4.0.0" 9 | 10 | # Dependencies specify other packages that your package needs in order to work. 11 | # To automatically upgrade your package dependencies to the latest versions 12 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 13 | # dependencies can be manually updated by changing the version numbers below to 14 | # the latest version available on pub.dev. To see which dependencies have newer 15 | # versions available, run `flutter pub outdated`. 16 | dependencies: 17 | cupertino_icons: ^1.0.3 18 | desktop_webview_window: ^0.2.3 19 | flutter: 20 | sdk: flutter 21 | flutter_web_auth_2: ^5.0.0-alpha.0 22 | 23 | dev_dependencies: 24 | flutter_lints: ^6.0.0 25 | flutter_test: 26 | sdk: flutter 27 | 28 | 29 | # For information on the generic Dart part of this file, see the 30 | # following page: https://dart.dev/tools/pub/pubspec 31 | 32 | # The following section is specific to Flutter packages. 33 | flutter: 34 | 35 | # The following line ensures that the Material Icons font is 36 | # included with your application, so that you can use the icons in 37 | # the material Icons class. 38 | uses-material-design: true 39 | 40 | # To add assets to your application, add an assets section, like this: 41 | # assets: 42 | # - images/a_dot_burr.jpeg 43 | # - images/a_dot_ham.jpeg 44 | 45 | # An image asset can refer to one or more resolution-specific "variants", see 46 | # https://flutter.dev/to/resolution-aware-images 47 | 48 | # For details regarding adding assets from package dependencies, see 49 | # https://flutter.dev/to/asset-from-package 50 | 51 | # To add custom fonts to your application, add a fonts section here, 52 | # in this "flutter" section. Each entry in this list should have a 53 | # "family" key with the font family name, and a "fonts" key with a 54 | # list giving the asset and other descriptors for the font. For 55 | # example: 56 | # fonts: 57 | # - family: Schyler 58 | # fonts: 59 | # - asset: fonts/Schyler-Regular.ttf 60 | # - asset: fonts/Schyler-Italic.ttf 61 | # style: italic 62 | # - family: Trajan Pro 63 | # fonts: 64 | # - asset: fonts/TrajanPro.ttf 65 | # - asset: fonts/TrajanPro_Bold.ttf 66 | # weight: 700 67 | # 68 | # For details regarding fonts from package dependencies, 69 | # see https://flutter.dev/to/font-from-package 70 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | void main() {} 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/auth.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Authentication complete 5 | 6 | 7 |

Authentication will complete in around two seconds. If this does not happen automatically, please close the window.

8 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/web/favicon.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_web_auth_2_example 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_web_auth_2_example", 3 | "short_name": "flutter_web_auth_2_example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "Demonstrates how to use the flutter_web_auth_2 plugin.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | DesktopWebviewWindowPluginRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("DesktopWebviewWindowPlugin")); 16 | UrlLauncherWindowsRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 18 | WindowToFrontPluginRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("WindowToFrontPlugin")); 20 | } 21 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | desktop_webview_window 7 | url_launcher_windows 8 | window_to_front 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.linusu" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.linusu. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /flutter_web_auth_2/example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /flutter_web_auth_2/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/ephemeral/ 38 | /Flutter/flutter_export_environment.sh 39 | 40 | .build/ 41 | .swiftpm/ 42 | -------------------------------------------------------------------------------- /flutter_web_auth_2/ios/flutter_web_auth_2.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint flutter_web_auth_2.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'flutter_web_auth_2' 7 | s.version = '5.0.0-alpha.2' 8 | s.summary = 'Flutter plugin for authenticating a user with a web service.' 9 | s.description = <<-DESC 10 | Flutter plugin for authenticating a user with a web service. 11 | DESC 12 | s.homepage = 'https://github.com/ThexXTURBOXx/flutter_web_auth_2' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Nico Mexis' => 'nico.mexis@kabelmail.de' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'flutter_web_auth_2/Sources/flutter_web_auth_2/**/*.swift' 17 | s.dependency 'Flutter' 18 | s.platform = :ios, '11.0' 19 | 20 | # Flutter.framework does not contain a i386 slice. 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 22 | s.swift_version = '5.9' 23 | end 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2/ios/flutter_web_auth_2/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.9 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "flutter_web_auth_2", 8 | platforms: [ 9 | .iOS("11.0") 10 | ], 11 | products: [ 12 | .library(name: "flutter-web-auth-2", targets: ["flutter_web_auth_2"]) 13 | ], 14 | dependencies: [], 15 | targets: [ 16 | .target( 17 | name: "flutter_web_auth_2", 18 | dependencies: [], 19 | resources: [] 20 | ) 21 | ] 22 | ) 23 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/flutter_web_auth_2.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter_web_auth_2/src/options.dart'; 6 | import 'package:flutter_web_auth_2/src/platform/platform_is.dart'; 7 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 8 | 9 | export 'src/options.dart'; 10 | export 'src/unsupported.dart' 11 | if (dart.library.io) 'src/linows.dart' 12 | if (dart.library.js_interop) 'src/web.dart'; 13 | 14 | class _OnAppLifecycleResumeObserver extends WidgetsBindingObserver { 15 | _OnAppLifecycleResumeObserver(this.onResumed); 16 | 17 | final Future Function() onResumed; 18 | 19 | @override 20 | Future didChangeAppLifecycleState(AppLifecycleState state) async { 21 | if (state == AppLifecycleState.resumed) { 22 | await onResumed(); 23 | } 24 | } 25 | } 26 | 27 | /// Provides all the functions you - as a user - should access. 28 | class FlutterWebAuth2 { 29 | static final RegExp _schemeRegExp = RegExp(r'^[a-z][a-z\d+.-]*$'); 30 | 31 | static FlutterWebAuth2Platform get _platform => 32 | FlutterWebAuth2Platform.instance; 33 | 34 | static final _OnAppLifecycleResumeObserver _resumedObserver = 35 | _OnAppLifecycleResumeObserver(_cleanUpDanglingCalls); 36 | 37 | static void _assertCallbackScheme(String callbackUrlScheme) { 38 | if ((PlatformIs.web || (!PlatformIs.windows && !PlatformIs.linux)) && 39 | !_schemeRegExp.hasMatch(callbackUrlScheme)) { 40 | throw ArgumentError.value( 41 | callbackUrlScheme, 42 | 'callbackUrlScheme', 43 | 'must be a valid URL scheme', 44 | ); 45 | } 46 | } 47 | 48 | /// Ask the user to authenticate to the specified web service. 49 | /// 50 | /// The page pointed to by [url] will be loaded and displayed to the user. 51 | /// From the page, the user can authenticate herself and grant access to the 52 | /// app. On completion, the service will send a callback URL with an 53 | /// authentication token, and this URL will be result of the returned 54 | /// [Future]. 55 | /// 56 | /// [callbackUrlScheme] should be a string specifying the scheme of the URL 57 | /// that the page will redirect to upon successful authentication. 58 | /// If it is `https`, you also need to specify 59 | /// [FlutterWebAuth2Options.httpsHost] and [FlutterWebAuth2Options.httpsPath] 60 | /// on Apple devices running iOS >= 17.4 or macOS >= 14.4. This allows for 61 | /// easy integration of Universal links. 62 | /// 63 | /// [options] can be used to specify either both general and 64 | /// platform-specific settings. 65 | static Future authenticate({ 66 | required String url, 67 | required String callbackUrlScheme, 68 | FlutterWebAuth2Options options = const FlutterWebAuth2Options(), 69 | }) async { 70 | assert( 71 | !(kIsWeb && options.debugOrigin != null && !kDebugMode), 72 | 'Do not use debugOrigin in production', 73 | ); 74 | 75 | _assertCallbackScheme(callbackUrlScheme); 76 | 77 | WidgetsBinding.instance.removeObserver( 78 | _resumedObserver, 79 | ); // safety measure so we never add this observer twice 80 | WidgetsBinding.instance.addObserver(_resumedObserver); 81 | return _platform.authenticate( 82 | url: url, 83 | callbackUrlScheme: callbackUrlScheme, 84 | options: options.toJson(), 85 | ); 86 | } 87 | 88 | /// The plugin may need to store the resulting callbacks in order to pass 89 | /// the result back to the caller of `authenticate`. But if that result never 90 | /// comes the callback will dangle around forever. This can be called to 91 | /// terminate all `authenticate` calls with an error. 92 | static Future _cleanUpDanglingCalls() async { 93 | await _platform.clearAllDanglingCalls(); 94 | WidgetsBinding.instance.removeObserver(_resumedObserver); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/linows.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 4 | import 'package:flutter_web_auth_2/src/server.dart'; 5 | import 'package:flutter_web_auth_2/src/webview.dart'; 6 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 7 | 8 | /// Implements the plugin interface for Linux and Windows (Linows). 9 | class FlutterWebAuth2LinowsPlugin extends FlutterWebAuth2Platform { 10 | final FlutterWebAuth2Platform _webviewImpl = FlutterWebAuth2WebViewPlugin(); 11 | final FlutterWebAuth2Platform _serverImpl = FlutterWebAuth2ServerPlugin(); 12 | 13 | /// Registers the Linows super-implementation. 14 | static void registerWith() { 15 | FlutterWebAuth2Platform.instance = FlutterWebAuth2LinowsPlugin(); 16 | } 17 | 18 | @override 19 | Future authenticate({ 20 | required String url, 21 | required String callbackUrlScheme, 22 | required Map options, 23 | }) async { 24 | final parsedOptions = FlutterWebAuth2Options.fromJson(options); 25 | if (parsedOptions.useWebview) { 26 | return _webviewImpl.authenticate( 27 | url: url, 28 | callbackUrlScheme: callbackUrlScheme, 29 | options: options, 30 | ); 31 | } 32 | return _serverImpl.authenticate( 33 | url: url, 34 | callbackUrlScheme: callbackUrlScheme, 35 | options: options, 36 | ); 37 | } 38 | 39 | @override 40 | Future clearAllDanglingCalls() async { 41 | await _serverImpl.clearAllDanglingCalls(); 42 | await _webviewImpl.clearAllDanglingCalls(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/macos.dart: -------------------------------------------------------------------------------- 1 | // MacOS just needs the MethodChannel implementation 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/platform/platform_is.dart: -------------------------------------------------------------------------------- 1 | // Adapted from https://gist.github.com/rydmike/1771fe24c050ebfe792fa309371154d8 2 | 3 | import 'package:flutter_web_auth_2/src/platform/universal_platform_none.dart' 4 | if (dart.library.io) 'package:flutter_web_auth_2/src/platform/universal_platform_vm.dart' 5 | if (dart.library.js_interop) 'package:flutter_web_auth_2/src/platform/universal_platform_web.dart'; 6 | 7 | /// A universal platform checker. 8 | /// 9 | /// Can be used to check active physical Flutter platform on all platforms. 10 | /// 11 | /// To check what host platform the app is running on use: 12 | /// 13 | /// * PlatformIs.android 14 | /// * PlatformIs.iOS 15 | /// * PlatformIs.macOS 16 | /// * PlatformIs.windows 17 | /// * PlatformIs.linux 18 | /// * PlatformIs.fuchsia 19 | /// 20 | /// To check the device type use: 21 | /// 22 | /// * PlatformIs.mobile (Android or iOS) 23 | /// * PlatformIs.desktop (Windows, macOS or Linux) 24 | /// 25 | /// Currently Fuchsia is not considered mobile nor desktop, even if it 26 | /// might be so in the future. 27 | /// 28 | /// To check if the Flutter application is running on Web you can use: 29 | /// 30 | /// * PlatformIs.web 31 | /// 32 | /// Alternatively the Flutter foundation compile time constant kIsWeb also 33 | /// works well for that. 34 | /// 35 | /// The platform checks are supported independently on web. You can use 36 | /// PlatformIs windows, iOS, macOS, Android and Linux to check what the host 37 | /// platform is when you are running a Flutter Web application. 38 | /// 39 | /// Checking if we are running on a Fuchsia host in a Web browser, is not yet 40 | /// fully supported. If running in a Web browser on Fuchsia, PlatformIs.web 41 | /// will be true, but PlatformIs.fuchsia will be false. Future versions, when 42 | /// Fuchsia is released, may fix this. 43 | class PlatformIs { 44 | PlatformIs._(); 45 | 46 | /// Is Web? 47 | static bool get web => UniversalPlatform.web; 48 | 49 | /// Is macOS? 50 | static bool get macOS => UniversalPlatform.macOS; 51 | 52 | /// Is Windows? 53 | static bool get windows => UniversalPlatform.windows; 54 | 55 | /// Is Linux? 56 | static bool get linux => UniversalPlatform.linux; 57 | 58 | /// Is Android? 59 | static bool get android => UniversalPlatform.android; 60 | 61 | /// Is iOS? 62 | static bool get iOS => UniversalPlatform.iOS; 63 | 64 | /// Is Fuchsia? 65 | static bool get fuchsia => UniversalPlatform.fuchsia; 66 | 67 | /// Is Mobile? 68 | static bool get mobile => PlatformIs.iOS || PlatformIs.android; 69 | 70 | /// Is Desktop? 71 | static bool get desktop => 72 | PlatformIs.macOS || PlatformIs.windows || PlatformIs.linux; 73 | } 74 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/platform/universal_platform_none.dart: -------------------------------------------------------------------------------- 1 | // Adapted from https://gist.github.com/rydmike/1771fe24c050ebfe792fa309371154d8 2 | 3 | // NOTE: 4 | // Never import this library directly in the application. The PlatformIs 5 | // class and library uses conditional imports to only import this file on 6 | // VM platform builds. 7 | 8 | /// UniversalPlatform for just a "none" implementation when the platform 9 | /// cannot be identified for some reason. 10 | class UniversalPlatform { 11 | UniversalPlatform._(); 12 | 13 | /// Is Web? 14 | static bool get web => false; 15 | 16 | /// Is macOS? 17 | static bool get macOS => false; 18 | 19 | /// Is Windows? 20 | static bool get windows => false; 21 | 22 | /// Is Linux? 23 | static bool get linux => false; 24 | 25 | /// Is Android? 26 | static bool get android => false; 27 | 28 | /// Is iOS? 29 | static bool get iOS => false; 30 | 31 | /// Is Fuchsia? 32 | static bool get fuchsia => false; 33 | } 34 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/platform/universal_platform_vm.dart: -------------------------------------------------------------------------------- 1 | // Adapted from https://gist.github.com/rydmike/1771fe24c050ebfe792fa309371154d8 2 | 3 | import 'dart:io'; 4 | 5 | // NOTE: 6 | // Never import this library directly in the application. The PlatformIs 7 | // class and library uses conditional imports to only import this file on 8 | // VM platform builds. 9 | 10 | /// UniversalPlatform for Flutter VM builds. 11 | /// 12 | /// We are using Dart VM builds, so we use dart:io Platform to 13 | /// get the current platform. 14 | class UniversalPlatform { 15 | UniversalPlatform._(); 16 | 17 | /// Is Web? 18 | static bool get web => false; 19 | 20 | /// Is macOS? 21 | static bool get macOS => Platform.isMacOS; 22 | 23 | /// Is Windows? 24 | static bool get windows => Platform.isWindows; 25 | 26 | /// Is Linux? 27 | static bool get linux => Platform.isLinux; 28 | 29 | /// Is Android? 30 | static bool get android => Platform.isAndroid; 31 | 32 | /// Is iOS? 33 | static bool get iOS => Platform.isIOS; 34 | 35 | /// Is Fuchsia? 36 | static bool get fuchsia => Platform.isFuchsia; 37 | } 38 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/platform/universal_platform_web.dart: -------------------------------------------------------------------------------- 1 | // Adapted from https://gist.github.com/rydmike/1771fe24c050ebfe792fa309371154d8 2 | 3 | // ignore: avoid_web_libraries_in_flutter 4 | import 'package:web/web.dart'; 5 | 6 | // NOTE: 7 | // Never import this library directly in the application. The PlatformIs 8 | // class and library uses conditional imports to only import this file on 9 | // Web platform builds. 10 | 11 | final Navigator _nav = window.navigator; 12 | 13 | /// UniversalPlatform for Flutter WEB build. 14 | /// 15 | /// We can use dart:html Navigator to get the current platform. 16 | /// 17 | /// This function is borrowed, with minor modifications, from GetX utils library 18 | /// with MIT license. 19 | /// Credits for it belong to its author Jonny Borges https://github.com/jonataslaw 20 | /// https://github.com/jonataslaw/getx/blob/master/lib/get_utils/src/platform/platform_web.dart 21 | /// 22 | class UniversalPlatform { 23 | UniversalPlatform._(); 24 | 25 | /// Is Web? 26 | static bool get web => true; 27 | 28 | /// Is macOS? 29 | static bool get macOS => _nav.appVersion.contains('Mac OS') && !iOS; 30 | 31 | /// Is Windows? 32 | static bool get windows => _nav.appVersion.contains('Win'); 33 | 34 | /// Is Linux? 35 | static bool get linux => 36 | (_nav.appVersion.contains('Linux') || _nav.appVersion.contains('x11')) && 37 | !android; 38 | 39 | /// Is Android? 40 | /// Source: https://developer.chrome.com/multidevice/user-agent 41 | static bool get android => _nav.appVersion.contains('Android '); 42 | 43 | /// Is iOS? 44 | /// maxTouchPoints is needed to separate iPad iOS13 vs new MacOS 45 | static bool get iOS => 46 | _hasMatch(_nav.platform, '/iPad|iPhone|iPod/') || 47 | (_nav.platform == 'MacIntel' && _nav.maxTouchPoints > 1); 48 | 49 | /// Is Fuchsia? 50 | /// Theoretically we could be in a Web browser on Fuchsia too, but 51 | /// we have no info on how to get that info yet, so we return false. 52 | static bool get fuchsia => false; 53 | } 54 | 55 | bool _hasMatch(String? value, String pattern) => 56 | // ignore: avoid_bool_literals_in_conditional_expressions 57 | (value == null) ? false : RegExp(pattern).hasMatch(value); 58 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/server.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 6 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 7 | import 'package:url_launcher/url_launcher.dart'; 8 | import 'package:window_to_front/window_to_front.dart'; 9 | 10 | /// Implements the plugin interface using an internal server (currently used by 11 | /// Windows and Linux). 12 | class FlutterWebAuth2ServerPlugin extends FlutterWebAuth2Platform { 13 | HttpServer? _server; 14 | Timer? _authTimeout; 15 | 16 | @override 17 | Future authenticate({ 18 | required String url, 19 | required String callbackUrlScheme, 20 | required Map options, 21 | }) async { 22 | final parsedOptions = FlutterWebAuth2Options.fromJson(options); 23 | 24 | // Validate callback url 25 | final callbackUri = Uri.parse(callbackUrlScheme); 26 | 27 | if (callbackUri.scheme != 'http' || 28 | (callbackUri.host != 'localhost' && callbackUri.host != '127.0.0.1') || 29 | !callbackUri.hasPort) { 30 | throw ArgumentError( 31 | 'Callback url scheme must start with http://localhost:{port}', 32 | ); 33 | } 34 | 35 | await _server?.close(force: true); 36 | 37 | _server = await HttpServer.bind('127.0.0.1', callbackUri.port); 38 | String? result; 39 | 40 | _authTimeout?.cancel(); 41 | _authTimeout = Timer(Duration(seconds: parsedOptions.timeout), () { 42 | _server?.close(); 43 | }); 44 | 45 | await launchUrl(Uri.parse(url)); 46 | 47 | await _server!.listen((req) async { 48 | req.response.headers.add('Content-Type', 'text/html'); 49 | req.response.write(parsedOptions.landingPageHtml); 50 | await req.response.close(); 51 | 52 | result = req.requestedUri.toString(); 53 | await _server?.close(); 54 | _server = null; 55 | }).asFuture(); 56 | 57 | await _server?.close(force: true); 58 | _authTimeout?.cancel(); 59 | 60 | if (result != null) { 61 | await WindowToFront.activate(); 62 | return result!; 63 | } 64 | throw PlatformException(message: 'User canceled login', code: 'CANCELED'); 65 | } 66 | 67 | @override 68 | Future clearAllDanglingCalls() async { 69 | await _server?.close(force: true); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/unsupported.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 3 | 4 | /// Implements the plugin interface for unsupported platforms (just throws 5 | /// errors). 6 | class FlutterWebAuth2UnsupportedPlugin extends FlutterWebAuth2Platform { 7 | /// Registers the unsupported implementation. 8 | static void registerWith() { 9 | FlutterWebAuth2Platform.instance = FlutterWebAuth2UnsupportedPlugin(); 10 | } 11 | 12 | @override 13 | Future authenticate({ 14 | required String url, 15 | required String callbackUrlScheme, 16 | required Map options, 17 | }) async { 18 | throw PlatformException( 19 | message: 'Platform either unsupported or unrecognised.', 20 | code: 'UNSUPPORTED', 21 | ); 22 | } 23 | 24 | @override 25 | Future clearAllDanglingCalls() async { 26 | throw PlatformException( 27 | message: 'Platform either unsupported or unrecognised.', 28 | code: 'UNSUPPORTED', 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/web.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:js_interop'; 4 | 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter_web_auth_2/src/options.dart'; 7 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 8 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 9 | import 'package:url_launcher/url_launcher.dart'; 10 | import 'package:web/web.dart'; 11 | 12 | /// Implements the plugin interface using iframes (for silent authentication) 13 | /// and through an event listener system (for usual authentication). 14 | class FlutterWebAuth2WebPlugin extends FlutterWebAuth2Platform { 15 | /// Registers the web implementation. 16 | static void registerWith(Registrar registrar) { 17 | final channel = MethodChannel( 18 | 'flutter_web_auth_2', 19 | const StandardMethodCodec(), 20 | registrar, 21 | ); 22 | final instance = FlutterWebAuth2WebPlugin(); 23 | channel.setMethodCallHandler(instance._handleMethodCall); 24 | FlutterWebAuth2Platform.instance = instance; 25 | } 26 | 27 | Future _handleMethodCall(MethodCall call) async { 28 | switch (call.method) { 29 | case 'authenticate': 30 | final url = call.arguments['url'].toString(); 31 | return authenticate( 32 | url: url, 33 | callbackUrlScheme: '', 34 | options: call.arguments['options'], 35 | ); 36 | default: 37 | throw PlatformException( 38 | code: 'Unimplemented', 39 | details: "The flutter_web_auth_2 plugin for web doesn't implement " 40 | "the method '${call.method}'", 41 | ); 42 | } 43 | } 44 | 45 | @override 46 | Future authenticate({ 47 | required String url, 48 | required String callbackUrlScheme, 49 | required Map options, 50 | }) async { 51 | final parsedOptions = FlutterWebAuth2Options.fromJson(options); 52 | 53 | if (parsedOptions.silentAuth) { 54 | final authIframe = (document.createElement('iframe') as HTMLIFrameElement) 55 | ..src = url 56 | ..style.display = 'none'; 57 | 58 | document.body?.append(authIframe); 59 | 60 | final completer = Completer(); 61 | StreamSubscription? messageSubscription; 62 | Timer? responseTimeoutTimer; 63 | 64 | messageSubscription = window.onMessage.listen((messageEvent) { 65 | if (messageEvent.origin == 66 | (parsedOptions.debugOrigin ?? Uri.base.origin)) { 67 | final data = messageEvent.data.dartify(); 68 | final authMessage = 69 | data != null && data is Map ? data['flutter-web-auth-2'] : null; 70 | if (authMessage is String) { 71 | authIframe.remove(); 72 | completer.complete(authMessage); 73 | responseTimeoutTimer?.cancel(); 74 | messageSubscription?.cancel(); 75 | } 76 | } 77 | }); 78 | 79 | // Add a timeout for the iframe response 80 | responseTimeoutTimer = 81 | Timer(Duration(seconds: parsedOptions.timeout), () { 82 | authIframe.remove(); 83 | messageSubscription?.cancel(); 84 | completer.completeError( 85 | PlatformException( 86 | code: 'timeout', 87 | message: 'Timeout waiting for the iframe response', 88 | ), 89 | ); 90 | }); 91 | 92 | return completer.future; 93 | } 94 | 95 | await launchUrl( 96 | Uri.parse(url), 97 | webOnlyWindowName: parsedOptions.windowName, 98 | ); 99 | 100 | // Remove the old record if it exists 101 | const storageKey = 'flutter-web-auth-2'; 102 | window.localStorage.removeItem(storageKey); 103 | Timer? lsTimer; 104 | StreamSubscription? messageSubscription; 105 | final completer = Completer(); 106 | try { 107 | // Periodically check for the callback value in local storage. 108 | // If it exists, return it. If not, check the timeout. 109 | // If the timeout has passed, throw an exception. 110 | lsTimer = Timer.periodic(const Duration(seconds: 1), (timer) { 111 | final flutterWebAuthMessage = window.localStorage.getItem(storageKey); 112 | if (flutterWebAuthMessage != null) { 113 | completer.complete(flutterWebAuthMessage); 114 | window.localStorage.removeItem(storageKey); 115 | messageSubscription?.cancel(); 116 | timer.cancel(); 117 | } else if (timer.tick >= parsedOptions.timeout) { 118 | messageSubscription?.cancel(); 119 | timer.cancel(); 120 | completer.completeError( 121 | PlatformException( 122 | code: 'error', 123 | message: 'Timeout waiting for callback value', 124 | ), 125 | ); 126 | } 127 | }); 128 | 129 | // Traditional window.opener method of listening for the redirect 130 | messageSubscription = window.onMessage.listen( 131 | (messageEvent) { 132 | if (messageEvent.origin == 133 | (parsedOptions.debugOrigin ?? Uri.base.origin)) { 134 | final data = messageEvent.data.dartify(); 135 | final flutterWebAuthMessage = 136 | data != null && data is Map ? data['flutter-web-auth-2'] : null; 137 | if (flutterWebAuthMessage is String) { 138 | lsTimer?.cancel(); 139 | messageSubscription?.cancel(); 140 | completer.complete(flutterWebAuthMessage); 141 | } 142 | } 143 | 144 | final appleOrigin = Uri(scheme: 'https', host: 'appleid.apple.com'); 145 | if (messageEvent.origin == appleOrigin.toString()) { 146 | try { 147 | final data = jsonDecode(messageEvent.data.toString()); 148 | if (data['method'] == 'oauthDone') { 149 | final appleAuth = 150 | data['data']['authorization'] as Map?; 151 | if (appleAuth != null) { 152 | final appleAuthQuery = Uri(queryParameters: appleAuth).query; 153 | lsTimer?.cancel(); 154 | messageSubscription?.cancel(); 155 | completer.complete( 156 | appleOrigin.replace(fragment: appleAuthQuery).toString(), 157 | ); 158 | } 159 | } 160 | } on FormatException { 161 | // ignore exception 162 | } 163 | } 164 | }, 165 | onError: (error) { 166 | lsTimer?.cancel(); 167 | messageSubscription?.cancel(); 168 | throw error; 169 | }, 170 | ); 171 | } catch (e) { 172 | lsTimer?.cancel(); 173 | completer.completeError(e); 174 | } 175 | 176 | return completer.future; 177 | } 178 | 179 | @override 180 | Future clearAllDanglingCalls() async {} 181 | } 182 | -------------------------------------------------------------------------------- /flutter_web_auth_2/lib/src/webview.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:desktop_webview_window/desktop_webview_window.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 6 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 7 | import 'package:path_provider/path_provider.dart'; 8 | 9 | /// Implements the plugin interface using the Webview interface (currently used 10 | /// by Windows and Linux). 11 | class FlutterWebAuth2WebViewPlugin extends FlutterWebAuth2Platform { 12 | bool _authenticated = false; 13 | Webview? _webview; 14 | 15 | @override 16 | Future authenticate({ 17 | required String url, 18 | required String callbackUrlScheme, 19 | required Map options, 20 | }) async { 21 | if (!await WebviewWindow.isWebviewAvailable()) { 22 | // Microsoft's WebView2 must be installed for this to work 23 | throw StateError('Webview is not available'); 24 | } 25 | 26 | final parsedOptions = FlutterWebAuth2Options.fromJson(options); 27 | 28 | // Reset 29 | _authenticated = false; 30 | _webview?.close(); 31 | 32 | final c = Completer(); 33 | _webview = await WebviewWindow.create( 34 | configuration: CreateConfiguration( 35 | windowHeight: 720, 36 | windowWidth: 1280, 37 | title: 'Authenticate', 38 | titleBarTopPadding: 0, 39 | userDataFolderWindows: (await getTemporaryDirectory()).path, 40 | ), 41 | ); 42 | _webview!.addOnUrlRequestCallback((url) { 43 | final uri = Uri.parse(url); 44 | if (uri.scheme != callbackUrlScheme || 45 | (parsedOptions.httpsHost != null && 46 | uri.host != parsedOptions.httpsHost) || 47 | (parsedOptions.httpsPath != null && 48 | uri.path != parsedOptions.httpsPath)) { 49 | return; 50 | } 51 | _authenticated = true; 52 | _webview?.close(); 53 | /** 54 | * Not setting the webview to null will cause a crash if the 55 | * application tries to open another webview 56 | */ 57 | _webview = null; 58 | c.complete(url); 59 | }); 60 | unawaited( 61 | _webview!.onClose.whenComplete( 62 | () { 63 | /** 64 | * Not setting the webview to null will cause a crash if the 65 | * application tries to open another webview 66 | */ 67 | _webview = null; 68 | if (!_authenticated) { 69 | c.completeError( 70 | PlatformException(code: 'CANCELED', message: 'User canceled'), 71 | ); 72 | } 73 | }, 74 | ), 75 | ); 76 | _webview!.launch(url); 77 | return c.future; 78 | } 79 | 80 | @override 81 | Future clearAllDanglingCalls() async {} 82 | } 83 | -------------------------------------------------------------------------------- /flutter_web_auth_2/macos/.gitignore: -------------------------------------------------------------------------------- 1 | .build/ 2 | .swiftpm/ 3 | -------------------------------------------------------------------------------- /flutter_web_auth_2/macos/flutter_web_auth_2.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint flutter_web_auth_2.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'flutter_web_auth_2' 7 | s.version = '5.0.0-alpha.2' 8 | s.summary = 'Flutter plugin for authenticating a user with a web service.' 9 | s.description = <<-DESC 10 | Flutter plugin for authenticating a user with a web service. 11 | DESC 12 | s.homepage = 'https://github.com/ThexXTURBOXx/flutter_web_auth_2' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Nico Mexis' => 'nico.mexis@kabelmail.de' } 15 | 16 | s.source = { :path => '.' } 17 | s.source_files = 'flutter_web_auth_2/Sources/flutter_web_auth_2/**/*.swift' 18 | s.dependency 'FlutterMacOS' 19 | s.platform = :osx, '10.15' 20 | 21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 22 | s.swift_version = '5.9' 23 | end 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2/macos/flutter_web_auth_2/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.9 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "flutter_web_auth_2", 8 | platforms: [ 9 | .macOS("10.15") 10 | ], 11 | products: [ 12 | .library(name: "flutter-web-auth-2", targets: ["flutter_web_auth_2"]) 13 | ], 14 | dependencies: [], 15 | targets: [ 16 | .target( 17 | name: "flutter_web_auth_2", 18 | dependencies: [], 19 | resources: [] 20 | ) 21 | ] 22 | ) 23 | -------------------------------------------------------------------------------- /flutter_web_auth_2/macos/flutter_web_auth_2/Sources/flutter_web_auth_2/FlutterWebAuth2Plugin.swift: -------------------------------------------------------------------------------- 1 | import AuthenticationServices 2 | import SafariServices 3 | import FlutterMacOS 4 | 5 | @available(OSX 10.15, *) 6 | public class FlutterWebAuth2Plugin: NSObject, FlutterPlugin, ASWebAuthenticationPresentationContextProviding { 7 | public static func register(with registrar: FlutterPluginRegistrar) { 8 | let channel = FlutterMethodChannel(name: "flutter_web_auth_2", binaryMessenger: registrar.messenger) 9 | let instance = FlutterWebAuth2Plugin() 10 | registrar.addMethodCallDelegate(instance, channel: channel) 11 | } 12 | 13 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 14 | if call.method == "authenticate", 15 | let arguments = call.arguments as? [String: AnyObject], 16 | let urlString = arguments["url"] as? String, 17 | let url = URL(string: urlString), 18 | let callbackURLScheme = arguments["callbackUrlScheme"] as? String, 19 | let options = arguments["options"] as? [String: AnyObject] 20 | { 21 | var sessionToKeepAlive: Any? // if we do not keep the session alive, it will get closed immediately while showing the dialog 22 | let completionHandler = { (url: URL?, err: Error?) in 23 | sessionToKeepAlive = nil 24 | 25 | if let err = err { 26 | if case ASWebAuthenticationSessionError.canceledLogin = err { 27 | result(FlutterError(code: "CANCELED", message: "User canceled login", details: nil)) 28 | return 29 | } 30 | 31 | result(FlutterError(code: "EUNKNOWN", message: err.localizedDescription, details: nil)) 32 | return 33 | } 34 | 35 | guard let url = url else { 36 | result(FlutterError(code: "EUNKNOWN", message: "URL was null, but no error provided.", details: nil)) 37 | return 38 | } 39 | 40 | result(url.absoluteString) 41 | } 42 | 43 | var _session: ASWebAuthenticationSession? = nil 44 | if #available(macOS 14.4, *) { 45 | if (callbackURLScheme == "https") { 46 | guard let host = options["httpsHost"] as? String else { 47 | result(FlutterError.invalidHttpsHostError) 48 | return 49 | } 50 | 51 | guard let path = options["httpsPath"] as? String else { 52 | result(FlutterError.invalidHttpsPathError) 53 | return 54 | } 55 | 56 | _session = ASWebAuthenticationSession(url: url, callback: ASWebAuthenticationSession.Callback.https(host: host, path: path), completionHandler: completionHandler) 57 | } else { 58 | _session = ASWebAuthenticationSession(url: url, callback: ASWebAuthenticationSession.Callback.customScheme(callbackURLScheme), completionHandler: completionHandler) 59 | } 60 | } else { 61 | _session = ASWebAuthenticationSession(url: url, callbackURLScheme: callbackURLScheme, completionHandler: completionHandler) 62 | } 63 | let session = _session! 64 | 65 | if let preferEphemeral = options["preferEphemeral"] as? Bool { 66 | session.prefersEphemeralWebBrowserSession = preferEphemeral 67 | } 68 | session.presentationContextProvider = self 69 | 70 | session.start() 71 | sessionToKeepAlive = session 72 | } else if call.method == "cleanUpDanglingCalls" { 73 | // we do not keep track of old callbacks on macOS, so nothing to do here 74 | result(nil) 75 | } else { 76 | result(FlutterMethodNotImplemented) 77 | } 78 | } 79 | 80 | @available(macOS 10.15, *) 81 | public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { 82 | return NSApplication.shared.windows.first { $0.isKeyWindow } ?? ASPresentationAnchor() 83 | } 84 | } 85 | 86 | fileprivate extension FlutterError { 87 | static var invalidHttpsHostError: FlutterError { 88 | return FlutterError(code: "INVALID_HTTPS_HOST_ERROR", message: "Failed to retrieve host for https scheme", details: nil) 89 | } 90 | 91 | static var invalidHttpsPathError: FlutterError { 92 | return FlutterError(code: "INVALID_HTTPS_PATH_ERROR", message: "Failed to retrieve path for https scheme", details: nil) 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /flutter_web_auth_2/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_web_auth_2 2 | description: Flutter plugin for authenticating a user with a web service. 3 | version: 5.0.0-alpha.7 4 | resolution: workspace 5 | homepage: https://github.com/ThexXTURBOXx/flutter_web_auth_2 6 | repository: https://github.com/ThexXTURBOXx/flutter_web_auth_2 7 | issue_tracker: https://github.com/ThexXTURBOXx/flutter_web_auth_2/issues 8 | funding: 9 | - https://github.com/sponsors/ThexXTURBOXx 10 | screenshots: 11 | - description: "flutter_web_auth_2 in action on Android" 12 | path: screen-android.gif 13 | - description: "flutter_web_auth_2 in action on iOS" 14 | path: screen-ios.gif 15 | - description: "flutter_web_auth_2 in action on MacOS" 16 | path: screen-macos.gif 17 | topics: 18 | - authentication 19 | - network 20 | - oauth 21 | - web 22 | 23 | environment: 24 | sdk: ">=3.5.0 <4.0.0" 25 | flutter: ">=3.24.0" 26 | 27 | dependencies: 28 | desktop_webview_window: ^0.2.3 29 | flutter: 30 | sdk: flutter 31 | flutter_web_auth_2_platform_interface: ^5.0.0-alpha.0 32 | flutter_web_plugins: 33 | sdk: flutter 34 | path_provider: ^2.1.2 35 | url_launcher: ^6.1.6 36 | web: ">=0.5.0 <2.0.0" 37 | window_to_front: ^0.0.3 38 | 39 | dev_dependencies: 40 | flutter_lints: ^6.0.0 41 | flutter_test: 42 | sdk: flutter 43 | 44 | flutter: 45 | plugin: 46 | platforms: 47 | android: 48 | package: com.linusu.flutter_web_auth_2 49 | pluginClass: FlutterWebAuth2Plugin 50 | ios: 51 | pluginClass: FlutterWebAuth2Plugin 52 | linux: 53 | dartPluginClass: FlutterWebAuth2LinowsPlugin 54 | fileName: src/linows.dart 55 | macos: 56 | pluginClass: FlutterWebAuth2Plugin 57 | web: 58 | pluginClass: FlutterWebAuth2WebPlugin 59 | fileName: src/web.dart 60 | windows: 61 | dartPluginClass: FlutterWebAuth2LinowsPlugin 62 | fileName: src/linows.dart 63 | -------------------------------------------------------------------------------- /flutter_web_auth_2/screen-android.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/screen-android.gif -------------------------------------------------------------------------------- /flutter_web_auth_2/screen-ios.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/screen-ios.gif -------------------------------------------------------------------------------- /flutter_web_auth_2/screen-macos.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThexXTURBOXx/flutter_web_auth_2/6a915866c3f71fe6327375d5a4a448be21b627e3/flutter_web_auth_2/screen-macos.gif -------------------------------------------------------------------------------- /flutter_web_auth_2/test/flutter_web_auth_2_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 4 | 5 | void main() { 6 | const channel = MethodChannel('flutter_web_auth_2'); 7 | 8 | setUp(() { 9 | TestWidgetsFlutterBinding.ensureInitialized(); 10 | 11 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 12 | .setMockMethodCallHandler(channel, (methodCall) async { 13 | expect(methodCall.method, 'authenticate'); 14 | 15 | expect( 16 | methodCall.arguments['url'] as String, 17 | 'https://example.com/login', 18 | ); 19 | expect(methodCall.arguments['callbackUrlScheme'] as String, 'foobar'); 20 | 21 | return 'https://example.com/success'; 22 | }); 23 | }); 24 | 25 | tearDown(() { 26 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 27 | .setMockMethodCallHandler(channel, null); 28 | }); 29 | 30 | test('authenticate', () async { 31 | expect( 32 | await FlutterWebAuth2.authenticate( 33 | url: 'https://example.com/login', 34 | callbackUrlScheme: 'foobar', 35 | ), 36 | 'https://example.com/success', 37 | ); 38 | }); 39 | 40 | test('invalid scheme', () async { 41 | await expectLater( 42 | FlutterWebAuth2.authenticate( 43 | url: 'https://example.com/login', 44 | callbackUrlScheme: 'foobar://test', 45 | ), 46 | throwsA(isA()), 47 | ); 48 | }); 49 | } 50 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .gradle/ 10 | .history 11 | .svn/ 12 | migrate_working_dir/ 13 | 14 | # IntelliJ related 15 | *.iml 16 | *.ipr 17 | *.iws 18 | .idea/ 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | #.vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 27 | pubspec.lock 28 | pubspec_overrides.yaml 29 | **/doc/api/ 30 | **/ios/Flutter/.last_build_id 31 | .dart_tool/ 32 | .flutter-plugins 33 | .flutter-plugins-dependencies 34 | .packages 35 | .pub-cache/ 36 | .pub/ 37 | /build/ 38 | 39 | # Symbolication related 40 | app.*.symbols 41 | 42 | # Obfuscation related 43 | app.*.map.json 44 | 45 | # Android Studio will place build artifacts here 46 | /android/app/debug 47 | /android/app/profile 48 | /android/app/release 49 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "e1e47221e86272429674bec4f1bd36acc4fc7b77" 8 | channel: "stable" 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 5.0.0-alpha.4 2 | 3 | - 🌹 Update melos to regular `7.x` releases 4 | - 🌹 Update linter to `6.x` 5 | 6 | ## 5.0.0-alpha.0 7 | 8 | - 💥 Update melos to `7.x` (requires SDK `>=3.5.0`) 9 | 10 | ## 4.1.0 11 | 12 | - No change 13 | 14 | ## 4.0.1 15 | 16 | - 🌹 Update `flutter_lints` to `5.x` - should not really change anything! 17 | 18 | ## 4.0.0 19 | 20 | *No changes - just the official version release!* 21 | 22 | ## 4.0.0-alpha.1 23 | 24 | - 🌹 Fix lint for Flutter 3.19.x 25 | 26 | ## 4.0.0-alpha.0 27 | 28 | - 🌹 Update to new major version in conjunction with main package 29 | 30 | ## 3.1.0 31 | 32 | - 🌹 Fix lint for Flutter 3.16.x 33 | 34 | ## 3.0.0 35 | 36 | - 💥 Release next major version, yay! 37 | 38 | ## 3.0.0-alpha.3 39 | 40 | - 🌹 Add more entries to the pubspec 41 | 42 | ## 3.0.0-alpha.2 43 | 44 | - 🌹 Update some files from official Flutter template 45 | 46 | ## 3.0.0-alpha.0 47 | 48 | - 💥 Bump Dart SDK constraints to `>=2.15.0` 49 | - 💥 Huge refactor with more configuration possibilities 50 | - 🎉 Add `melos` to project 51 | 52 | ## 2.1.4 53 | 54 | - 🌹 Fix support for Dart `3.x` 55 | 56 | ## 2.1.3 57 | 58 | - 🌹 Add `contextArgs` for web implementations (See [#40](https://github.com/ThexXTURBOXx/flutter_web_auth_2/issues/40)) 59 | 60 | ## 2.1.0 61 | 62 | - 🌹 Update linter rules 63 | 64 | ## 2.0.1 65 | 66 | - 🌹 Added `redirectOriginOverride` for web implementations (By [Rexios80](https://github.com/Rexios80)) 67 | 68 | ## 2.0.0 69 | 70 | - 💥 Full two-package federated plugin refactor 71 | 72 | ## 1.1.2 73 | 74 | - No change 75 | 76 | ## 1.1.1 77 | 78 | - 🌹 Cleaned up platform implementations 79 | 80 | ## 1.1.0 81 | 82 | - No change 83 | 84 | ## 1.0.1 85 | 86 | - No change 87 | 88 | ## 1.0.0 89 | 90 | - Initial release 91 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Linus Unnebäck 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/README.md: -------------------------------------------------------------------------------- 1 | # flutter_web_auth_2_platform_interface 2 | 3 | A common platform interface for the `flutter_web_auth_2` plugin used by the different platform implementations. 4 | 5 | ## [See here for flutter_web_auth_2](https://pub.dev/packages/flutter_web_auth_2) 6 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/example/main.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_print 2 | 3 | void main() { 4 | print('See flutter_web_auth_2 for more information:'); 5 | print('https://pub.dev/packages/flutter_web_auth_2/example'); 6 | } 7 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/lib/flutter_web_auth_2_platform_interface.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_web_auth_2_platform_interface/method_channel/method_channel.dart'; 2 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 3 | 4 | /// The interface that implementations of FlutterWebAuth must implement. 5 | /// 6 | /// Platform implementations should extend this class rather than implement it 7 | /// because `implements` does not consider newly added methods to be breaking 8 | /// changes. Extending this class (using `extends`) ensures that the subclass 9 | /// will get the default implementation. 10 | abstract class FlutterWebAuth2Platform extends PlatformInterface { 11 | /// Construct a platform instance. 12 | FlutterWebAuth2Platform() : super(token: _token); 13 | 14 | static final Object _token = Object(); 15 | 16 | static FlutterWebAuth2Platform _instance = FlutterWebAuth2MethodChannel(); 17 | 18 | /// Get the currently used platform instance. 19 | static FlutterWebAuth2Platform get instance => _instance; 20 | 21 | /// Platform-specific plugins should set this with their own platform-specific 22 | /// class that extends [FlutterWebAuth2Platform] when they register 23 | /// themselves. 24 | static set instance(FlutterWebAuth2Platform instance) { 25 | PlatformInterface.verify(instance, _token); 26 | _instance = instance; 27 | } 28 | 29 | /// Ask the user to authenticate to the specified web service. 30 | /// 31 | /// The page pointed to by [url] will be loaded and displayed to the user. 32 | /// From the page, the user can authenticate herself and grant access to the 33 | /// app. On completion, the service will send a callback URL with an 34 | /// authentication token, and this URL will be result of the returned 35 | /// [Future]. 36 | /// 37 | /// [callbackUrlScheme] should be a string specifying the scheme of the URL 38 | /// that the page will redirect to upon successful authentication. 39 | /// 40 | /// [options] can be used to specify either both general and 41 | /// platform-specific settings. It should be JSON-formatted. 42 | Future authenticate({ 43 | required String url, 44 | required String callbackUrlScheme, 45 | required Map options, 46 | }) => 47 | _instance.authenticate( 48 | url: url, 49 | callbackUrlScheme: callbackUrlScheme, 50 | options: options, 51 | ); 52 | 53 | /// The plugin may need to store the resulting callbacks in order to pass 54 | /// the result back to the caller of `authenticate`. But if that result never 55 | /// comes the callback will dangle around forever. This can be called to 56 | /// terminate all `authenticate` calls with an error. 57 | Future clearAllDanglingCalls() => _instance.clearAllDanglingCalls(); 58 | } 59 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/lib/method_channel/method_channel.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; 3 | 4 | /// Method channel implementation of the [FlutterWebAuth2Platform]. 5 | class FlutterWebAuth2MethodChannel extends FlutterWebAuth2Platform { 6 | static const MethodChannel _channel = MethodChannel('flutter_web_auth_2'); 7 | 8 | @override 9 | Future authenticate({ 10 | required String url, 11 | required String callbackUrlScheme, 12 | required Map options, 13 | }) async => 14 | await _channel.invokeMethod('authenticate', { 15 | 'url': url, 16 | 'callbackUrlScheme': callbackUrlScheme, 17 | 'options': options, 18 | }) ?? 19 | ''; 20 | 21 | @override 22 | Future clearAllDanglingCalls() async => 23 | _channel.invokeMethod('cleanUpDanglingCalls'); 24 | } 25 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_web_auth_2_platform_interface 2 | description: A common platform interface for the flutter_web_auth_2 plugin. 3 | version: 5.0.0-alpha.4 4 | resolution: workspace 5 | homepage: https://github.com/ThexXTURBOXx/flutter_web_auth_2 6 | repository: https://github.com/ThexXTURBOXx/flutter_web_auth_2 7 | issue_tracker: https://github.com/ThexXTURBOXx/flutter_web_auth_2/issues 8 | funding: 9 | - https://github.com/sponsors/ThexXTURBOXx 10 | 11 | environment: 12 | sdk: ">=3.5.0 <4.0.0" 13 | flutter: ">=3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | plugin_platform_interface: ^2.1.2 19 | 20 | dev_dependencies: 21 | flutter_lints: ^6.0.0 22 | flutter_test: 23 | sdk: flutter 24 | -------------------------------------------------------------------------------- /flutter_web_auth_2_platform_interface/test/flutter_web_auth_platform_interface_test.dart: -------------------------------------------------------------------------------- 1 | void main() {} 2 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_web_auth_2_root 2 | 3 | publish_to: none 4 | 5 | environment: 6 | sdk: '>=3.6.0 <4.0.0' 7 | 8 | workspace: 9 | - flutter_web_auth_2 10 | - flutter_web_auth_2/example 11 | - flutter_web_auth_2_platform_interface 12 | 13 | dev_dependencies: 14 | flutter_lints: ^6.0.0 15 | melos: ^7.1.0 16 | --------------------------------------------------------------------------------