func (a *OAuth2Authenticator) Authenticate(ctx context.Context, client *chttp.Client) error {
	buf := &bytes.Buffer{}
	if err := json.NewEncoder(buf).Encode(a); err != nil {
		return err
	}
	var result struct {
		Name string `json:"name"`
	}
	if _, err := client.DoJSON(ctx, kivik.MethodPost, "/_session", &chttp.Options{Body: buf}, &result); err != nil {
		return err
	}
	return chttp.ValidateAuth(ctx, result.Name, client)
}
// Authenticate attempts to authenticate with an OAuth2 token.
Authenticate attempts to authenticate with an OAuth2 token.
// Authenticate attempts to authenticate with an OAuth2 token .
func (a *OAuth2Authenticator) Authenticate(ctx context.Context, client *chttp.Client) error {
	buf := &bytes.Buffer{}
	if err := json.NewEncoder(buf).Encode(a); err != nil {
		return err
	}
	var result struct {
		Name string `json:"name"`
	}
	if _, err := client.DoJSON(ctx, kivik.MethodPost, "/_session", &chttp.Options{Body: buf}, &result); err != nil {
		return err
	}
	return chttp.ValidateAuth(ctx, result.Name, client)
}
func ( a * OAuth2Authenticator ) Authenticate ( ctx context . Context , client * chttp . Client ) error { buf := & bytes . Buffer { } if err := json . NewEncoder ( buf ) . Encode ( a ) ; err != nil { return err } var result struct { Name string `json:"name"` } if _ , err := client . DoJSON ( ctx , kivik . MethodPost , " " , & chttp . Options { Body : buf } , & result ) ; err != nil { return err } return chttp . ValidateAuth ( ctx , result . Name , client ) }
Authenticate attempts to authenticate with an OAuth2 token.
Authenticate attempts to authenticate with an OAuth2 token .