Skip to content

Commit

Permalink
Update otp fields as per authorizer 1.1.56
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhansamani committed Jul 23, 2023
1 parent 553059b commit 93f295f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
17 changes: 9 additions & 8 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (

// AuthTokenResponseFragment defines graphql response for auth token type,
// which is common across various authorizer operations
var AuthTokenResponseFragment = fmt.Sprintf(`message access_token expires_in refresh_token id_token should_show_otp_screen user { %s }`, UserFragment)
var AuthTokenResponseFragment = fmt.Sprintf(`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen user { %s }`, UserFragment)

// User defines attributes for user instance
type User struct {
Expand All @@ -43,13 +43,14 @@ type User struct {
// AuthTokenResponse defines attribute for auth token response,
// which is common across various authorizer operations
type AuthTokenResponse struct {
Message *string `json:"message,omitempty"`
AccessToken *string `json:"access_token,omitempty"`
ExpiresIn *int64 `json:"expires_in,omitempty"`
IdToken *string `json:"id_token,omitempty"`
RefreshToken *string `json:"refresh_token,omitempty"`
OtpSent *bool `json:"should_show_otp_screen"`
User *User `json:"user,omitempty"`
Message *string `json:"message,omitempty"`
AccessToken *string `json:"access_token,omitempty"`
ExpiresIn *int64 `json:"expires_in,omitempty"`
IdToken *string `json:"id_token,omitempty"`
RefreshToken *string `json:"refresh_token,omitempty"`
ShouldShowEmailOtpScreen *bool `json:"should_show_email_otp_screen"`
ShouldShowMobileOtpScreen *bool `json:"should_show_mobile_otp_screen"`
User *User `json:"user,omitempty"`
}

// Response defines attribute for Response graphql type
Expand Down
4 changes: 2 additions & 2 deletions examples/resend_otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ func ResendOTPExample() {
if err != nil {
panic(err)
}

email := "[email protected]"
res, err := c.ResendOTP(&authorizer.ResendOTPInput{
Email: "[email protected]",
Email: &email,
})
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions examples/verify_otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ func VerifyOTPExample() {
if err != nil {
panic(err)
}

email := "[email protected]"
res, err := c.VerifyOTP(&authorizer.VerifyOTPInput{
OTP: "test",
Email: "[email protected]",
Email: &email,
})
if err != nil {
panic(err)
Expand Down
3 changes: 2 additions & 1 deletion resend_otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (

// ResendOTPInput defines attributes for resend_otp request
type ResendOTPInput struct {
Email string `json:"email"`
Email *string `json:"email"`
PhoneNumber *string `json:"phone_number"`
}

// ResendOTP is method attached to AuthorizerClient.
Expand Down
5 changes: 3 additions & 2 deletions verify_otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (

// VerifyOTPInput defines attributes for verify_otp request
type VerifyOTPInput struct {
Email string `json:"email"`
OTP string `json:"otp"`
Email *string `json:"email"`
OTP string `json:"otp"`
PhoneNumber *string `json:"phone_number"`
}

// VerifyOTP is method attached to AuthorizerClient.
Expand Down

0 comments on commit 93f295f

Please sign in to comment.