Shows how to connect to a web application with an OAuth interface.
#The example shows the connection of an app
Facebook, Twitter, Flickr and Google Services
To configure Google OAuth connections
Auth0 with Google on the API Console.
- Log in to [API Console] (https://console.developers.google.com/)
- Complete information about your instance of Auth0.
- Enable the Google+ API.
- Set up Consent Screen.
- Get your ClientId and ClientSecret.
- Enable Admin SDK service.
Essential code sample
In Scenario Google
String GoogleURL = "https://accounts.google.com/o/oauth2/auth?client_id=" + Uri.EscapeDataString(GoogleClientID.Text) + "&redirect_uri=" + Uri.EscapeDataString(GoogleCallbackUrl.Text) + "&response_type=code&scope=" + Uri.EscapeDataString("http://picasaweb.google.com/data");
Uri StartUri = new Uri(GoogleURL); // When using the desktop flow, the success code is displayed in the html title of this end uri Uri EndUri = new Uri("https://accounts.google.com/o/oauth2/approval");
rootPage.NotifyUser("Navigating to: " + GoogleURL, NotifyType.StatusMessage);
WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.UseTitle, StartUri, EndUri); if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success) { OutputToken(WebAuthenticationResult.ResponseData.ToString()); } else if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp) { OutputToken("HTTP Error returned by AuthenticateAsync() : " + WebAuthenticationResult.ResponseErrorDetail.ToString()); } else { OutputToken("Error returned by AuthenticateAsync() : " + WebAuthenticationResult.ResponseStatus.ToString()); }
|