fusionauth with flutter
-
We are trying to integrate fusionAuth with flutter and I have already refereed to the posts
https://pub.dev/packages/flutter_appauth/example
//https://fusionauth.io/community/forum/topic/428/social-login-with-flutter-app/6I have tried the code and it works good with Auth0 but I am not able to get it working with fusionAuth
here is the link to Auth0 code
https://github.com/auth0-blog/flutter-authentication/blob/main/lib/main.dartI replaced the code with FusionAuth credentials, it opens the webclient but after authentication callback I get the below error..
Below is the code
const String FUSIONAUTH_DOMAIN= 'fusionauth.mydomain.com';
const String FUSIONAUTH_CLIENTID = 'xxxxxxx-83a4-4523-823e-2b4390df1ef8';
const String FUSIONAUTH_REDIRECT_URI = 'com.test.flutter://login-callback';
const String FUSIONAUTH_ISSUER = 'https://$FUSIONAUTH_DOMAIN';
const String FUSIONAUTH_DISCOVERY_URL = 'https://fusionauth.mydomain.com/.well-known/openid-configuration/xxxxxxx-9068-48fb-9af4-7b279d66395c';final List<String> _scopes = <String>[
'openid',
'profile',
'email',
'offline_access',
'api'
];Future<void> loginAction() async {
setState(() {
isBusy = true;
errorMessage = '';
});
try {
AuthorizationTokenResponse result;
await appAuth.authorizeAndExchangeCode(
AuthorizationTokenRequest(
FUSIONAUTH_CLIENTID,
FUSIONAUTH_REDIRECT_URI,
issuer: FUSIONAUTH_ISSUER,
//discoveryUrl: FUSIONAUTH_DISCOVERY_URL,
scopes: _scopes,
),
);.. rest of the code is same from Auth0 example..
It throws me an error saying
[ error:invalid_client_descripition, C
Client authentication missing as Basic Authorization header or credentials in the body (or some combination of them).], null, nullif somebody can point what am I doing wrong
-
We just published a flutter tutorial that might be worth reading: https://fusionauth.io/blog/2020/11/23/securing-flutter-oauth/