amplify-codegen icon indicating copy to clipboard operation
amplify-codegen copied to clipboard

Ability to override AuthMode in generated API.service.ts

Open JrPribs opened this issue 3 years ago • 6 comments

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

JrPribs avatar May 24 '22 14:05 JrPribs

Hey @JrPribs thanks for raising this and for linking the other feature request! Given this issue is related to codegen I will transfer this over to our amplify-category-api repo for better assistance

josefaidt avatar May 24 '22 16:05 josefaidt

I've marked this as a codegen feature request for the team to evaluate further 🙂

josefaidt avatar May 24 '22 16:05 josefaidt

@josefaidt thanks!

JrPribs avatar May 24 '22 20:05 JrPribs

Any updates on this?

pglotov avatar Jun 05 '23 00:06 pglotov

Any progress on this change?

mikev10 avatar Nov 02 '23 19:11 mikev10