aws-amplify / aws-amplify/docs
API(Rest), document how to use ID token instead of access token
- Dominant language
- MDX
- Stars
- 506
- Forks
- 1.1k
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 1
Description
### 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](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-enable-cognito-user-pool.html)
> 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](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-create-cognito-user-pool.html), 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
- [X] API (REST)
- [ ] API (GraphQL)
- [X] Auth
- [ ] Authenticator
- [ ] DataStore
- [ ] Notifications (Push)
- [ ] Storage
### Steps to Reproduce
_No response_
### Screenshots
_No response_
### Platforms
- [X] iOS
- [X] Android
- [ ] Web
- [ ] macOS
- [ ] Windows
- [ ] Linux
### Flutter Version
3.10.2
### Amplify Flutter Version
1.2.0
### Deployment Method
Amplify CLI
### Schema
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.