How to Get code from api call for grant_type : authorization_code

I am developing twitch integration as a background service in python 3.8(legacy application).

As per the documentation, to get the code for grant_type : authorization_code, even using twitchapi library, it requires to open browser and approve.

But in our case, we are integrating as background service and it application is deployed as Lambda function in AWS cloud and there we can not have browser to opan and perform actions.

Please suggest to get code via api call only for grant_type : authorization_code so as to generate the access_token which is required to call api for CREATE CLIP.

Rest all good with integration.

That is how oAuth works yes…

No way around it, to get permission to act on behalf of the user will require the user to allow that access via a web browser.

Even with Device Code Flow this will still require the opening of a browser to complete the necassary steps. You just don’t need a web server running to recieve the ?code to exchange for a token

But once you have the initial user oauth token and it’s refresh token, you can continue to operate until the refresh is no longer valid then reseed the system

I imagine since you can’t run anything “normal” you’d have to provide an initial user access token and user refresh token manually for the system to use and reseed manually when needed, but need to account for a new access/refresh being returned on refresh for use by the system