Identity Toolkit API v2 - Package cloud.google.com/go/identitytoolkit/apiv2 (v0.2.4)

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.

 // 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://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, mentioned above.

 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.

Functions

func DefaultAuthScopes

  func 
  
 DefaultAuthScopes 
 () 
  
 [] 
  string 
 
 

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

AccountManagementCallOptions

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

AccountManagementCallOptions contains the retry settings for each method of AccountManagementClient.

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 
 } 
 

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 
 } 
 

func (*AccountManagementClient) Close

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 
 } 
 

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 
 } 
 

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 
 } 
 

AuthenticationCallOptions

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

AuthenticationCallOptions contains the retry settings for each method of AuthenticationClient.

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 
 } 
 

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 
 } 
 

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 
 } 
 

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 
 } 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: