How to implement Google Drive API in Xamarin Forms?

Liêm_NguyễnLiêm_Nguyễn USMember ✭✭✭

Hi everybody!
I search on Internet a lot about this question, but I don't see any clear sample about this for Xamarin Forms.
They said need client_secret, API key, Authentication a lot of thing.
Please give me suggestions step by step I need to implement Google Drive API in Xamarin Forms (include UWP, iOS and Android).
Thank!

Tagged:

Answers

  • Liêm_NguyễnLiêm_Nguyễn USMember ✭✭✭
    edited March 24

    I have follow Google API for NET

    UserCredential credential;
    using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
    {
    credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
    GoogleClientSecrets.Load(stream).Secrets,
    new[] { BooksService.Scope.Books },
    "user", CancellationToken.None, new FileDataStore("Books.ListMyLibrary"));
    }
    Where I will put this file "client_secrets.json" (NET Standard project or every platform project)
    How to read it
    Where to save "new FileDataStore("My_App")"

  • Liêm_NguyễnLiêm_Nguyễn USMember ✭✭✭

    I get this error One or more errors occurred. (Failed to launch browser with "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&response_type=code&client_id

Sign In or Register to comment.