identitytoolkit

package
v0.0.0-...-0ceec32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package identitytoolkit is an auto-generated package for the Identity Toolkit API.

The Google Identity Toolkit API lets you use open standards to verify a user’s identity.

General documentation

For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:

Example usage

To get started with this package, create a client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := identitytoolkit.NewAccountManagementClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := identitytoolkit.NewAccountManagementClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

req := &identitytoolkitpb.FinalizeMfaEnrollmentRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb#FinalizeMfaEnrollmentRequest.
}
resp, err := c.FinalizeMfaEnrollment(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewAccountManagementClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type AccountManagementCallOptions

type AccountManagementCallOptions struct {
	FinalizeMfaEnrollment []gax.CallOption
	StartMfaEnrollment    []gax.CallOption
	WithdrawMfa           []gax.CallOption
}

AccountManagementCallOptions contains the retry settings for each method of AccountManagementClient.

type AccountManagementClient

type AccountManagementClient struct {

	// The call options for this service.
	CallOptions *AccountManagementCallOptions
	// contains filtered or unexported fields
}

AccountManagementClient is a client for interacting with Identity Toolkit API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Account management for Identity Toolkit

func NewAccountManagementClient

func NewAccountManagementClient(ctx context.Context, opts ...option.ClientOption) (*AccountManagementClient, error)

NewAccountManagementClient creates a new account management service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Account management for Identity Toolkit

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAccountManagementClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func NewAccountManagementRESTClient

func NewAccountManagementRESTClient(ctx context.Context, opts ...option.ClientOption) (*AccountManagementClient, error)

NewAccountManagementRESTClient creates a new account management service rest client.

Account management for Identity Toolkit

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAccountManagementRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*AccountManagementClient) Close

func (c *AccountManagementClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*AccountManagementClient) Connection deprecated

func (c *AccountManagementClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*AccountManagementClient) FinalizeMfaEnrollment

FinalizeMfaEnrollment finishes enrolling a second factor for the user.

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
	identitytoolkitpb "cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAccountManagementClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &identitytoolkitpb.FinalizeMfaEnrollmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb#FinalizeMfaEnrollmentRequest.
	}
	resp, err := c.FinalizeMfaEnrollment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AccountManagementClient) StartMfaEnrollment

StartMfaEnrollment step one of the MFA enrollment process. In SMS case, this sends an SMS verification code to the user.

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
	identitytoolkitpb "cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAccountManagementClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &identitytoolkitpb.StartMfaEnrollmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb#StartMfaEnrollmentRequest.
	}
	resp, err := c.StartMfaEnrollment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AccountManagementClient) WithdrawMfa

WithdrawMfa revokes one second factor from the enrolled second factors for an account.

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
	identitytoolkitpb "cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAccountManagementClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &identitytoolkitpb.WithdrawMfaRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb#WithdrawMfaRequest.
	}
	resp, err := c.WithdrawMfa(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type AuthenticationCallOptions

type AuthenticationCallOptions struct {
	FinalizeMfaSignIn []gax.CallOption
	StartMfaSignIn    []gax.CallOption
}

AuthenticationCallOptions contains the retry settings for each method of AuthenticationClient.

type AuthenticationClient

type AuthenticationClient struct {

	// The call options for this service.
	CallOptions *AuthenticationCallOptions
	// contains filtered or unexported fields
}

AuthenticationClient is a client for interacting with Identity Toolkit API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Authentication for Identity Toolkit

func NewAuthenticationClient

func NewAuthenticationClient(ctx context.Context, opts ...option.ClientOption) (*AuthenticationClient, error)

NewAuthenticationClient creates a new authentication service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Authentication for Identity Toolkit

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAuthenticationClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func NewAuthenticationRESTClient

func NewAuthenticationRESTClient(ctx context.Context, opts ...option.ClientOption) (*AuthenticationClient, error)

NewAuthenticationRESTClient creates a new authentication service rest client.

Authentication for Identity Toolkit

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAuthenticationRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*AuthenticationClient) Close

func (c *AuthenticationClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*AuthenticationClient) Connection deprecated

func (c *AuthenticationClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*AuthenticationClient) FinalizeMfaSignIn

FinalizeMfaSignIn verifies the MFA challenge and performs sign-in

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
	identitytoolkitpb "cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAuthenticationClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &identitytoolkitpb.FinalizeMfaSignInRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb#FinalizeMfaSignInRequest.
	}
	resp, err := c.FinalizeMfaSignIn(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AuthenticationClient) StartMfaSignIn

StartMfaSignIn sends the MFA challenge

Example
package main

import (
	"context"

	identitytoolkit "cloud.google.com/go/identitytoolkit/apiv2"
	identitytoolkitpb "cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := identitytoolkit.NewAuthenticationClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &identitytoolkitpb.StartMfaSignInRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/identitytoolkit/apiv2/identitytoolkitpb#StartMfaSignInRequest.
	}
	resp, err := c.StartMfaSignIn(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL