本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.9KB

  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package google provides support for making OAuth2 authorized and authenticated
  5. // HTTP requests to Google APIs. It supports the Web server flow, client-side
  6. // credentials, service accounts, Google Compute Engine service accounts, and Google
  7. // App Engine service accounts.
  8. //
  9. // A brief overview of the package follows. For more information, please read
  10. // https://developers.google.com/accounts/docs/OAuth2
  11. // and
  12. // https://developers.google.com/accounts/docs/application-default-credentials.
  13. //
  14. // OAuth2 Configs
  15. //
  16. // Two functions in this package return golang.org/x/oauth2.Config values from Google credential
  17. // data. Google supports two JSON formats for OAuth2 credentials: one is handled by ConfigFromJSON,
  18. // the other by JWTConfigFromJSON. The returned Config can be used to obtain a TokenSource or
  19. // create an http.Client.
  20. //
  21. //
  22. // Credentials
  23. //
  24. // The Credentials type represents Google credentials, including Application Default
  25. // Credentials.
  26. //
  27. // Use FindDefaultCredentials to obtain Application Default Credentials.
  28. // FindDefaultCredentials looks in some well-known places for a credentials file, and
  29. // will call AppEngineTokenSource or ComputeTokenSource as needed.
  30. //
  31. // DefaultClient and DefaultTokenSource are convenience methods. They first call FindDefaultCredentials,
  32. // then use the credentials to construct an http.Client or an oauth2.TokenSource.
  33. //
  34. // Use CredentialsFromJSON to obtain credentials from either of the two JSON formats
  35. // described in OAuth2 Configs, above. The TokenSource in the returned value is the
  36. // same as the one obtained from the oauth2.Config returned from ConfigFromJSON or
  37. // JWTConfigFromJSON, but the Credentials may contain additional information
  38. // that is useful is some circumstances.
  39. package google // import "golang.org/x/oauth2/google"
上海开阖软件有限公司 沪ICP备12045867号-1