auth0-flutter icon indicating copy to clipboard operation
auth0-flutter copied to clipboard

Failed to support LinkedIn login

Open fogfish opened this issue 1 year ago • 0 comments

Checklist

  • [X] The issue can be reproduced in the auth0_flutter sample app (or N/A).
  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

Usage of LinkedIn login and flutter web fails with the following error:

Error: TypeError: null: type 'Null' is not a subtype of type 'String'
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3   throw_
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1385:3                          _failedAsCheck
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1363:3                          _generalAsCheckImplementation
dart-sdk/lib/_internal/js_shared/lib/js_util_patch.dart 81:5                  getProperty
packages/auth0_flutter/src/web/extensions/web_exception_extensions.dart 6:19  WebExceptionExtension.fromJsObject
packages/auth0_flutter/src/web/auth0_flutter_plugin_real.dart 128:49          credentials
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>

The root cause is https://github.com/auth0/auth0-flutter/blob/main/auth0_flutter/lib/src/web/extensions/user_profile_extension.dart#L53

The lib expect locale claim to be String. However, LinkedIn return nested JSON Object:

"locale": {
    "country": "US",
    "language": "en"
  },

Reproduction

  1. Config LinkedIn OAuth app
  2. Config Auth0 to using this app
  3. Run auth0_flutter sample app with html renderer
  4. Login to LinkedIn

Additional context

No response

auth0_flutter version

1.6.0

Flutter version

Flutter 3.19.3 • channel stable

Platform

Web

Platform version(s)

No response

fogfish avatar Apr 08 '24 16:04 fogfish