Git Product home page Git Product logo

Comments (1)

Equartey avatar Equartey commented on June 11, 2024

Hi @yvvivek9, sorry you're having troubling setting up the Admin API.

I don't think there is an issue with the provided method. You do not need to explicitly define credentials on the request, its signed for you by the Amplify API call.

More likely the permissions on the user are incorrect. Please ensure the user you are logged in as belongs to the group you setup via the CLI. This is captured in this section https://docs.amplify.aws/javascript/build-a-backend/auth/admin-actions/#enable-admin-queries.

If you have added this permission, make sure you've signed out and signed back in to get a fresh token (my initial calls were failing due to this).

If your request is still failing, you can examine the Cloud Watch logs in the AWS console for the Lambda function and reference the lambda source code to further debug. The source code lives in your project under amplify/backend/function/AdminQueriesXXX/src, note changes to these files require an amplify push to update. To find the Lambda Cloud Watch logs simply search the Lambda console for your local folder name AdminQueriesXXX > click the "Monitor" tab > click the chip "View CloudWatch logs" > locate the relevant log stream.

For reference, I was able to setup and verify a successful Admin API in Dart using the following code snippet:

  Future<void> listAdmin() async {
    const path = "/listUsersInGroup";
    final query = {
      "groupname": "Admin",
    };
    const apiName = "AdminQueries";
    try {
      final restOperation = Amplify.API.get(
        path,
        queryParameters: query,
        apiName: apiName,
      );
      final response = await restOperation.response;
      print('GET call succeeded: ${response.decodeBody()}');
    } on ApiException catch (e) {
      print('GET call failed: $e');
    }
  }

If you are unable to resolve the error, please provide the full exception message and we are happy to help you further.

from amplify-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.