aws-amplify / aws-amplify/amplify-codegen

Ability to override AuthMode in generated API.service.ts

Open
#511 6 comments 0 reactions 0 assignees View on GitHub
feature-request transferred
Dominant language
TypeScript
Stars
59
Forks
64
PR merge metrics
No merged PRs in 30d

Description

### Is this feature request related to a new or existing Amplify category?

auth, api

### Is this related to another service?

_No response_

### Describe the feature you'd like to request

Unless I am missing something the current generated API.service.ts for use with Angular only allows you to work with the default auth strategy. In order to use iam unauthenticated logins I've had to write a custom service & queries to apply the authMode option override. This is not very obvious and obviously not ideal since all the queries are already conveniently available in the generated API service

PS I created an initial feature request in amplify-js repo but think this is actually the proper place for it. link to other feature request so one can be closed (https://github.com/aws-amplify/amplify-js/issues/9931)

### Describe the solution you'd like

I think it would be ideal to be able to pass in an optional authMode param to all the generated functions in the generated API.service.ts

### Describe alternatives you've considered

I am already writing an additional custom service to make my unauthenticated user calls, this is one option but not ideal.
Alternatively there could just be a second optional service generated that contains queries specific to an auth strategy, bu that seems like it would be much more effort and create more code on the client.

### Additional context

I would be happy to take a look at implementing this, but honestly don't know where that file generation logic lives. If you all are on board with the idea and could give me some direction on locating and updating that code I'd be happy to give it a go. thanks

### Is this something that you'd be interested in working on?

- [X] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.