Hello guys!
I am using xamarin for crossplatform ios/android about some moths now and also bought some tutorials in udemy about it. While a good portion of my app is completed i am wanted to use google calendar api and google authentication/sign in
I couldn't find a single completed tutorial how to do so and all the solutions i found online are either too complicated without structure or explanations , have details missing or refer to deleted links.
Is there someone who can provide me a good tutorial or example my top priority is to create a good working oauth2 google login and after that i can use i think easily google calendar with rest calls
Any help would be appreciated
here is one sample code i used that is not working
` Task OnLoginClickedAsync(object sender, EventArgs e)
{
string clientId = null;
string redirectUri = null;
string authorizeUri = Constants.AuthorizeUri;
string accessTokenUri = Constants.AuthorizeUri;
switch (Device.RuntimePlatform)
{
/* case Device.iOS:
clientId = Constants.iOSClientId;
redirectUri = Constants.iOSRedirectUrl;
break;*/
case Device.Android:
clientId = "152826923349-8n46ad52iub89udn4j7fds43nfmfc416.apps.googleusercontent.com";
redirectUri = "com.companyname.manager:/oauth2redirect";
break;
}
var authenticator = new OAuth2Authenticator(
clientId,
null,
scope: "email",
new Uri(authorizeUri),
new Uri(redirectUri),
new Uri(accessTokenUri),
null,
true);
authenticator.Completed += OnAuthCompleted;
authenticator.Error += OnAuthError;
Xamarin.Auth.Authenticator auth = authenticator;
var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
presenter.Login(auth);
}`