Skip to content

API(Rest), document how to use ID token instead of access token #5661

Open
@PritamDutt

Description

@PritamDutt

Description

Currently API(Rest) is hard coded to use accessToken, which requires scope definition for using Cognito as COGNITO_USER_POOLS authorizer with API Gateway, and is not really a use case for us. We want to be able to pass idToken instead of accessToken, but there is no provision for the same.

It will be really great, if we could somehow choose it as part of config process, or may be while making the API calls?

COGNITO_USER_POOLS usage excerpt from Amazon API Gateway Developer Guide

To use an access token, do the following:

Choose the pencil icon next to OAuth Scopes.

Type one or more full names of a scope that has been configured when the Amazon Cognito user pool was created. For example, following the example given in Create an Amazon Cognito user pool for a REST API, one of the scopes is https://my-petstore-api.example.com/cats.read. Use a single space to separate multiple scopes.

At runtime, the method call succeeds if any scope that's specified on the method in this step matches a scope that's claimed in the incoming token. Otherwise, the call fails with a 401 Unauthorized response.

To save the setting, choose the check mark icon.


Issue @
https://github.com/aws-amplify/amplify-flutter/blob/19834beca7942700154c342505eda80a48355787/packages/auth/amplify_auth_cognito_dart/lib/src/util/cognito_user_pools_auth_provider.dart#L19

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

No response

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.10.2

Amplify Flutter Version

1.2.0

Deployment Method

Amplify CLI

Schema

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions