1

I'm trying to upload some CSV files up to a google drive via a .Net web app. My first attempt doing this using a service account ended up a failure. My second attempt using OAuth for authentication has so far been successful (when running locally), but I fear that this won't work once deployed to a web server.

I'm using the following code to authenticate (VB.Net):

Dim userCreds As UserCredential

Using fs As New FileStream("client_secrets.json", FileMode.Open, FileAccess.Read)
    userCreds = GoogleWebAuthorizationBroker.AuthorizeAsync(
        GoogleClientSecrets.FromStream(fs).Secrets, myScopes, Environment.UserName, CancellationToken.None).Result()
End Using

The documentation for GoogleWebAuthorizationBroker states that this class "is only suitable for client-side use, as it starts a local browser that requires user interaction."

What would be the suitable way to authenticate via OAuth in a .Net server-side app?

1 Answer 1

1

Simple Answer

Use GoogleWebAuthorizationBroker for desktop.

For server-side web apps, use GoogleAuthorizationCodeFlow

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.