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://pkgo.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
// go get cloud.google.com/go/identitytoolkit/apiv2@latest 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://pkgo.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, mentioned above.
req := &identitytoolkitpb.FinalizeMfaEnrollmentRequest{ // TODO: Fill request struct fields. // See https://pkgo.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 ¶
- func DefaultAuthScopes() []string
- type AccountManagementCallOptions
- type AccountManagementClient
- func (c *AccountManagementClient) Close() error
- func (c *AccountManagementClient) Connection() *grpc.ClientConndeprecated
- func (c *AccountManagementClient) FinalizeMfaEnrollment(ctx context.Context, req *identitytoolkitpb.FinalizeMfaEnrollmentRequest, ...) (*identitytoolkitpb.FinalizeMfaEnrollmentResponse, error)
- func (c *AccountManagementClient) StartMfaEnrollment(ctx context.Context, req *identitytoolkitpb.StartMfaEnrollmentRequest, ...) (*identitytoolkitpb.StartMfaEnrollmentResponse, error)
- func (c *AccountManagementClient) WithdrawMfa(ctx context.Context, req *identitytoolkitpb.WithdrawMfaRequest, ...) (*identitytoolkitpb.WithdrawMfaResponse, error)
- type AuthenticationCallOptions
- type AuthenticationClient
- func (c *AuthenticationClient) Close() error
- func (c *AuthenticationClient) Connection() *grpc.ClientConndeprecated
- func (c *AuthenticationClient) FinalizeMfaSignIn(ctx context.Context, req *identitytoolkitpb.FinalizeMfaSignInRequest, ...) (*identitytoolkitpb.FinalizeMfaSignInResponse, error)
- func (c *AuthenticationClient) StartMfaSignIn(ctx context.Context, req *identitytoolkitpb.StartMfaSignInRequest, ...) (*identitytoolkitpb.StartMfaSignInResponse, error)
Examples ¶
- AccountManagementClient.FinalizeMfaEnrollment
- AccountManagementClient.StartMfaEnrollment
- AccountManagementClient.WithdrawMfa
- AuthenticationClient.FinalizeMfaSignIn
- AuthenticationClient.StartMfaSignIn
- NewAccountManagementClient
- NewAccountManagementRESTClient
- NewAuthenticationClient
- NewAuthenticationRESTClient
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://pkgo.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://pkgo.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 ¶
func (c *AccountManagementClient) FinalizeMfaEnrollment(ctx context.Context, req *identitytoolkitpb.FinalizeMfaEnrollmentRequest, opts ...gax.CallOption) (*identitytoolkitpb.FinalizeMfaEnrollmentResponse, error)
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://pkgo.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://pkgo.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 ¶
func (c *AccountManagementClient) StartMfaEnrollment(ctx context.Context, req *identitytoolkitpb.StartMfaEnrollmentRequest, opts ...gax.CallOption) (*identitytoolkitpb.StartMfaEnrollmentResponse, error)
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://pkgo.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://pkgo.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 ¶
func (c *AccountManagementClient) WithdrawMfa(ctx context.Context, req *identitytoolkitpb.WithdrawMfaRequest, opts ...gax.CallOption) (*identitytoolkitpb.WithdrawMfaResponse, error)
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://pkgo.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://pkgo.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://pkgo.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://pkgo.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 ¶
func (c *AuthenticationClient) FinalizeMfaSignIn(ctx context.Context, req *identitytoolkitpb.FinalizeMfaSignInRequest, opts ...gax.CallOption) (*identitytoolkitpb.FinalizeMfaSignInResponse, error)
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://pkgo.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://pkgo.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 ¶
func (c *AuthenticationClient) StartMfaSignIn(ctx context.Context, req *identitytoolkitpb.StartMfaSignInRequest, opts ...gax.CallOption) (*identitytoolkitpb.StartMfaSignInResponse, error)
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://pkgo.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://pkgo.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: