AccessToken generates an OAuth2 access token for the specified scopes on behalf of service account of this application. This token will expire after the returned time.
(c context.Context, scopes ...string)
| 77 | // behalf of service account of this application. This token will expire after |
| 78 | // the returned time. |
| 79 | func AccessToken(c context.Context, scopes ...string) (token string, expiry time.Time, err error) { |
| 80 | req := &pb.GetAccessTokenRequest{Scope: scopes} |
| 81 | res := &pb.GetAccessTokenResponse{} |
| 82 | |
| 83 | err = internal.Call(c, "app_identity_service", "GetAccessToken", req, res) |
| 84 | if err != nil { |
| 85 | return "", time.Time{}, err |
| 86 | } |
| 87 | return res.GetAccessToken(), time.Unix(res.GetExpirationTime(), 0), nil |
| 88 | } |
| 89 | |
| 90 | // Certificate represents a public certificate for the app. |
| 91 | type Certificate struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…