https://github.com/schibsted/account-sdk-flutter
Flutter plugin for Schibsted Account SDK
https://github.com/schibsted/account-sdk-flutter
flutter-plugin spid
Last synced: 15 days ago
JSON representation
Flutter plugin for Schibsted Account SDK
- Host: GitHub
- URL: https://github.com/schibsted/account-sdk-flutter
- Owner: schibsted
- License: mit
- Created: 2019-07-05T08:45:14.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-14T07:13:09.000Z (almost 6 years ago)
- Last Synced: 2025-04-08T06:02:28.741Z (about 1 month ago)
- Topics: flutter-plugin, spid
- Language: Kotlin
- Homepage:
- Size: 75.2 KB
- Stars: 2
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# schibsted_account_sdk
Flutter plugin for Schibsted Account SDK
> Disclaimer: This project is not maintained by Schibsted Account team. It is an independent initiative. Please report any issue or ideas directly into this repository. Pull requests are also welcome.
## Getting Started
### Example project
If you want to run the Android example project - please provide values in
`example/android/app/src/main/assets/schibsted_account.conf` file.
For more info visit the [SDK Setup doc](https://github.com/schibsted/account-sdk-android#sdk-setup "SDK Setup doc").If you want to run the iOS example project - please provide values in
`example/ios/Runner/SchibstedAccountConfig.plist` file.
For more info visit the [SDK Setup doc](https://github.com/schibsted/account-sdk-ios#setup "SDK Setup doc").### Android
1. Configure your Android project following the steps in [account-sdk-android docs](https://github.com/schibsted/account-sdk-android "account-sdk-android docs")2. Change the Application theme (Flutter creates a AndroidManifest.xml that applies a theme to the Activity, not the Application). To do that, remove the `android:theme="@style/LaunchTheme"` from the `` tag and add it to the `` tag.
Then change the parent of `@style/LaunchTheme` to `@style/Theme.AppCompat.Light.NoActionBar` or some other `AppCompat` theme.3. Add a file with to `/res/values` that has the following information:
```example client
example-scheme
://login```
### iOS
1. Configure your iOS project following the steps in [account-sdk-ios docs](https://github.com/schibsted/account-sdk-ios "account-sdk-ios docs")
2. Add to project file SchibstedAccountConfig.plist that has the following information:
```environment
preproduction
clientID
<client-id>
clientSecret
<client-secret>
appURLScheme
<url-schema>```
### Flutter
Import the classes with:
`import 'package:schibsted_account_sdk/schibsted_account.dart';`To start the login flow, just call:
`SchibstedAccountPlugin.login;`To log out, just call:
`SchibstedAccountPlugin.logout;`You can listen to the exposed `SchibstedAccountPlugin.loginEvents` Stream to get the `SchibstedAccountEvent` login events which contain the current state. State can be a value from the `SchibstedAccountState` enum:
- `logged_out` - user has logged out
- `logged_in` - user has logged in and we have the User Data (email, displayName, ...)
- `unknown` - should never happen. Would be sent if Android `resultCode` was unknown and not handeled by the plugin.
- `canceled` - user cancels the Login flow.
- `fetching` - user has logged in and we start to fetch the User Data (email, displayName, ...)
- `error` - when the SDK fails at some pointFor more reference on how to use the plugin check the `example` project in this repo.
### TODO
- [✖] Implement iOS
- [ ] Write tests