'OAuth2 with Gmail API - Redirect

As Google will disable the "Less secure app access" option, I'm implementing a Windows Forms Application (.NET Framework) for sending emails with OAuth. I logged into the Google Developers Console and created a "Desktop" type credential. When running my application I am redirected to the

https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?access_type=offline&response_type=code&client_id=...apps.googleusercontent.com&redirect_uri=http%3A%2F%2F127.0.0.1%3A62437%2Fauthorize%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.send&flowName=GeneralOAuthFlow

I log in and the email is sent, but after logging in, I am redirected to the

http://127.0.0.1:56332/authorize/?code=somecode&scope=https://www.googleapis.com/auth/gmail.send

Is there a way to not do this redirection? I don't need it. If required, can I change this uri? It doesn't make sense for me to redirect to 127.0.01, as it's the address of my client's machine, which has a desktop application installed.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source