Zeigt wie man sich in einen Webanwendung mit einer OAuth Schnittstelle verbindet.
#Das Beispiel zeigt die Verbindung einer App zu
Facebook, Twitter, Flickr und Google Services
To configure Google OAuth connections
(Google Apps and Google) you will need to register 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.
Wesentliches Codebeispiel
Unter 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()); } |