Using Xamrin.Auth

I am trying to use google drive services with flowing code and authentication

var auth = new OAuth2Authenticator (
clientId: "xxxxxxxxxxxxxx0l3kfifg24dg0hjprufd1cn7paupijjm.apps.googleusercontent.com",
scope: "https://www.googleapis.com/auth/drive",
authorizeUrl: new Uri ("https://accounts.google.com/o/oauth2/auth"),
redirectUrl: new Uri ("myredirect:oob"));

and trying to initialize the google drive services by

var service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = auth,
ApplicationName = "Google Drive API Sample",
});

but above code shows an error

Error CS0266: Cannot implicitly convert type 'Xamarin.Auth.OAuth2Authenticator' to 'Google.Apis.Http.IConfigurableHttpClientInitializer'. An explicit conversion exists (are you missing a cast?) (CS0266)

Please help me with the above problem

Answers

  • PragadeesPragadees USMember

    i am trying to use GoogleWebAuthorizationBroker which should be found in the name space using Google.Apis.Auth.OAuth2; but the above class is missing so pls help me to authorise google drive

Sign In or Register to comment.