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

Login with token results in invalid access token error message on checkout #59

Open
Zwnow opened this issue Nov 7, 2024 · 3 comments
Open

Comments

@Zwnow
Copy link

Zwnow commented Nov 7, 2024

Hello everyone,

I stumbled upon an issue with the Sumup.loginWithToken method.

This is my function:

Future<void> initializeAndLoginSumUp() async {
    final isStillLoggedIn = await Sumup.isLoggedIn;
    if (isStillLoggedIn != null) {
      if (isStillLoggedIn) {
        _isLoggedIn = true;
        notifyListeners();
        return;
      } else {
        //final response = await Sumup.loginWithToken(apiToken);
        final response = await Sumup.login();
        final message = response.message;
        if (message != null) {
          if (message['loginResult'] == true) {
            _isLoggedIn = true;
          }
        }
        notifyListeners();
      }
    }
  }

It is called everytime before I make an transaction within my application. Once a session expires and I relog with the line that is currently commented out, the login succeeds but when trying to process a checkout, it results in "Invalid access token" error and fails.

It works fine with the regular login method though!

Hope I was able to explain my issue somewhat understandable.

Best regards

@sstasi95
Copy link
Collaborator

sstasi95 commented Nov 7, 2024

Hi,

Check this issue, it might be a wrong grant type.

@Zwnow
Copy link
Author

Zwnow commented Nov 11, 2024

Hey, thanks for your answer. Unfortunately I don't use the API calls in my App. I was trying to make it work with the things the SDK natively provides. If I have to do it using URL requests & parameters, why would I use the SDK in the first place?

@sstasi95
Copy link
Collaborator

sstasi95 commented Jan 8, 2025

I meant that the token might have been generated in a wrong way, as discussed in that thread. Also, check that your OAuth app has all the required scopes, I think you need the 'payments' scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants