Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

39 строки
1.8 KiB

  1. // Copyright 2014 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
  5. import (
  6. "context"
  7. "time"
  8. "golang.org/x/oauth2"
  9. )
  10. // Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible.
  11. var appengineTokenFunc func(c context.Context, scopes ...string) (token string, expiry time.Time, err error)
  12. // Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible.
  13. var appengineAppIDFunc func(c context.Context) string
  14. // AppEngineTokenSource returns a token source that fetches tokens from either
  15. // the current application's service account or from the metadata server,
  16. // depending on the App Engine environment. See below for environment-specific
  17. // details. If you are implementing a 3-legged OAuth 2.0 flow on App Engine that
  18. // involves user accounts, see oauth2.Config instead.
  19. //
  20. // First generation App Engine runtimes (<= Go 1.9):
  21. // AppEngineTokenSource returns a token source that fetches tokens issued to the
  22. // current App Engine application's service account. The provided context must have
  23. // come from appengine.NewContext.
  24. //
  25. // Second generation App Engine runtimes (>= Go 1.11) and App Engine flexible:
  26. // AppEngineTokenSource is DEPRECATED on second generation runtimes and on the
  27. // flexible environment. It delegates to ComputeTokenSource, and the provided
  28. // context and scopes are not used. Please use DefaultTokenSource (or ComputeTokenSource,
  29. // which DefaultTokenSource will use in this case) instead.
  30. func AppEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
  31. return appEngineTokenSource(ctx, scope...)
  32. }