Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting TypeError: type 'Null' is not a subtype of type 'String' File "oauth_response.dart", #75

Open
rduffr opened this issue Sep 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@rduffr
Copy link

rduffr commented Sep 13, 2023

1. Current bug behavior

This used to work until I upgraded to the latest version of Flutter and Dart.
Code:

final oauth = TwitterOAuth2Client(
clientId: 'RGxNM2ZWeV94UUZFWGdLTDJmdzg6MTpjaQ',
clientSecret: '7E1YBMVA782yjeBowvAF_3sbidXvk9hJOmeGV_98fCf2K4teH5',
redirectUri: 'sportcast:https://',
customUriScheme: 'sportcast',
);

try {
  var response = await oauth.executeAuthCodeFlowWithPKCE(
    scopes: Scope.values,
  );

I get the following exception when oauth.executeAuthCodeFlowWithPKCE is called:

_TypeError: type 'Null' is not a subtype of type 'String'
File "oauth_response.dart", line 25, in new OAuthResponse.fromJson
File "twitter_oauth2_client.dart", line 163, in _TwitterOAuth2Client._requestAccessToken
File "twitter_oauth2_client.dart", line 78, in _TwitterOAuth2Client.executeAuthCodeFlowWithPKCE
File "signup_controller.dart", line 176, in SignUpController.twitterAuth
File "auth_screen_widget.dart", line 61, in AuthScreenWidget.build.
...
(3 additional frame(s) were not displayed)

2. Expected behavior

I expect a successful login to Twitter.

3. Steps to reproduce

Twitter account is configured (dev) correctly. Keys are correct.
Run the code.
Get the error.

4. Flutter doctor output

[✓] Chrome - develop for the web
[!] Android Studio (version unknown)
✗ Unable to determine Android Studio version.
[✓] IntelliJ IDEA Community Edition (version 2023.2.1)
[✓] VS Code (version 1.82.1)
[✓] Connected device (2 available)
[✓] Network resources

5. More environment information

import 'package:twitter_api_v2/twitter_api_v2.dart' as twitter_api;
import 'package:twitter_oauth2_pkce/twitter_oauth2_pkce.dart';

6. Log information

_TypeError: type 'Null' is not a subtype of type 'String'
File "oauth_response.dart", line 25, in new OAuthResponse.fromJson
File "twitter_oauth2_client.dart", line 163, in _TwitterOAuth2Client._requestAccessToken
File "twitter_oauth2_client.dart", line 78, in _TwitterOAuth2Client.executeAuthCodeFlowWithPKCE
File "signup_controller.dart", line 176, in SignUpController.twitterAuth
File "auth_screen_widget.dart", line 61, in AuthScreenWidget.build.
...
(3 additional frame(s) were not displayed)

7. More information

This used to work and suddenly stopped. Not sure if there were changed @ Twitter (X)

@rduffr rduffr added the bug Something isn't working label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants