Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fdi updates for account-linking #41

Merged
merged 7 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [1.18.0] - 2023-08-XX

### Changed
- Updates ThirdParty, ThirdPartyEmailPassword, ThirdPartyPasswordless, Passwordless and EmailPassword recipes to support account linking
- Updates `{apiBasePath}/signinup/code` POST
- Updates `{apiBasePath}/signinup/code/consume` POST
- Updates `{apiBasePath}/signinup` POST
- Updates `{apiBasePath}/signin` POST
- Updates `{apiBasePath}/signup` POST
- Updates `{apiBasePath}/user/password/reset/token` POST
- Updates `{apiBasePath}/user/password/reset` POST
- The changes to the above endpoints are:
- Added new response statuses
- Unified the type/shape of the user objects across all different responses
- Renamed `createdNewUser` to `createdNewRecipeUser`

## [1.17.0] - 2023-07-21

### Added
Expand Down
208 changes: 150 additions & 58 deletions api_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
description: |
These are the APIs exposed by our backend SDK. To be consumed by the frontend only.
`<tenantId>` in all the APIs are optional. Its default value is `public`
version: "1.17.0"
version: "1.18.0"
title: Frontend Driver Interface
contact:
email: [email protected]
Expand Down Expand Up @@ -49,7 +49,6 @@ paths:
$ref: '#/components/schemas/phoneNumber'
required:
- phoneNumber
- $ref: '#/components/schemas/generalErrorResponse'
responses:
'200':
description: Started the passwordless sign in/up process.
Expand All @@ -68,6 +67,14 @@ paths:
flowType:
type: string
enum: ['MAGIC_LINK', 'USER_INPUT_CODE_AND_MAGIC_LINK', 'USER_INPUT_CODE']
- type: object
properties:
status:
type: string
enum: ['SIGN_IN_UP_NOT_ALLOWED']
reason:
type: string
example: "Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)"
- $ref: '#/components/schemas/generalErrorResponse'

'404':
Expand Down Expand Up @@ -199,11 +206,11 @@ paths:
properties:
status:
$ref: '#/components/schemas/statusOK'
createdNewUser:
createdNewRecipeUser:
type: boolean
example: true
user:
$ref: '#/components/schemas/passwordlessUser'
$ref: '#/components/schemas/user'

- type: object
properties:
Expand All @@ -222,6 +229,14 @@ paths:
status:
type: string
enum: ['RESTART_FLOW_ERROR']
- type: object
properties:
status:
type: string
enum: ['SIGN_IN_UP_NOT_ALLOWED']
reason:
type: string
example: "Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)"

- $ref: '#/components/schemas/generalErrorResponse'

Expand Down Expand Up @@ -386,7 +401,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/signinupResponse'
- $ref: '#/components/schemas/noEmailGivenByProviderResponse'
- $ref: '#/components/schemas/signinupErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

'404':
Expand Down Expand Up @@ -529,6 +544,14 @@ paths:
flowType:
type: string
enum: ['MAGIC_LINK', 'USER_INPUT_CODE_AND_MAGIC_LINK', 'USER_INPUT_CODE']
- type: object
properties:
status:
type: string
enum: ['SIGN_IN_UP_NOT_ALLOWED']
reason:
type: string
example: "Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)"
- $ref: '#/components/schemas/generalErrorResponse'

'404':
Expand Down Expand Up @@ -656,11 +679,11 @@ paths:
properties:
status:
$ref: '#/components/schemas/statusOK'
createdNewUser:
createdNewRecipeUser:
type: boolean
example: true
user:
$ref: '#/components/schemas/passwordlessUser'
$ref: '#/components/schemas/user'

- type: object
properties:
Expand All @@ -679,6 +702,14 @@ paths:
status:
type: string
enum: ['RESTART_FLOW_ERROR']
- type: object
properties:
status:
type: string
enum: ['SIGN_IN_UP_NOT_ALLOWED']
reason:
type: string
example: "Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)"

- $ref: '#/components/schemas/generalErrorResponse'

Expand Down Expand Up @@ -1043,6 +1074,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/passwordResetTokenResponse'
- $ref: '#/components/schemas/passwordResetNotAllowedResponse'
- $ref: '#/components/schemas/fieldErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

Expand Down Expand Up @@ -1083,6 +1115,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/passwordResetResponse'
- $ref: '#/components/schemas/passwordResetErrorResponse'
- $ref: '#/components/schemas/fieldErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

Expand Down Expand Up @@ -1176,7 +1209,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/signinupResponse'
- $ref: '#/components/schemas/noEmailGivenByProviderResponse'
- $ref: '#/components/schemas/signinupErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

'404':
Expand Down Expand Up @@ -1530,6 +1563,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/passwordResetTokenResponse'
- $ref: '#/components/schemas/passwordResetNotAllowedResponse'
- $ref: '#/components/schemas/fieldErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

Expand Down Expand Up @@ -1570,6 +1604,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/passwordResetResponse'
- $ref: '#/components/schemas/passwordResetErrorResponse'
- $ref: '#/components/schemas/fieldErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

Expand Down Expand Up @@ -1665,7 +1700,7 @@ paths:
schema:
oneOf:
- $ref: '#/components/schemas/signinupResponse'
- $ref: '#/components/schemas/noEmailGivenByProviderResponse'
- $ref: '#/components/schemas/signinupErrorResponse'
- $ref: '#/components/schemas/generalErrorResponse'

'404':
Expand Down Expand Up @@ -2181,40 +2216,80 @@ components:
userId:
type: string
example: fa7a0841-b533-4478-95533-0fde890c3483

thirdPartyUser:
type: object
properties:
id:
$ref: '#/components/schemas/userId'
email:
type: string
example: [email protected]
timeJoined:
type: number
example: 1638433545183
thirdParty:
type: object
properties:
id:
type: string
example: google
userId:
type: string
example: rq238mrq2389rvq123213



user:
type: object
properties:
id:
$ref: '#/components/schemas/userId'
email:
type: string
example: [email protected]
timeJoined:
type: number
example: 1638433545183
isPrimaryUser:
type: boolean
example: true
tenantIds:
type: array
items:
type: string
example: public
emails:
type: array
items:
type: string
example: [email protected]
phoneNumbers:
type: array
items:
type: string
example: +36201234123
thirdParty:
type: array
items:
type: object
properties:
id:
type: string
example: google
userId:
type: string
example: rq238mrq2389rvq123213
loginMethods:
type: array
items:
type: object
properties:
recipeId:
type: string
enum: ['emailpassword', 'thirdparty', 'passwordless']
recipeUserId:
$ref: '#/components/schemas/userId'
verified:
type: boolean
example: true
tenantIds:
type: array
items:
type: string
example: public
timeJoined:
type: number
example: 1638433545183
email:
type: string
example: [email protected]
phoneNumber:
type: string
example: +36201234123
thirdParty:
type: object
properties:
id:
type: string
example: google
userId:
type: string
example: rq238mrq2389rvq123213

email:
type: string
Expand All @@ -2234,19 +2309,6 @@ components:
description: An identifier that used to identify the login attempt/device.
example: kFmkPQEAJtACiT2w/K8fndEuNm+XozJXSZSlWEr+iGs=

passwordlessUser:
type: object
properties:
id:
$ref: '#/components/schemas/userId'
email:
$ref: '#/components/schemas/email'
phoneNumber:
$ref: '#/components/schemas/phoneNumber'
timeJoined:
type: number
example: 1638433545183

thirdPartyId:
type: string
example: google
Expand Down Expand Up @@ -2325,24 +2387,44 @@ components:
status:
$ref: '#/components/schemas/statusOK'

passwordResetNotAllowedResponse:
type: object
properties:
status:
type: string
enum: ['PASSWORD_RESET_NOT_ALLOWED']
reason:
type: string
example: "Token generation was not done because of account take over risk. Please contact support. (HAS_OTHER_EMAIL_OR_PHONE)"

signinupResponse:
type: object
properties:
status:
$ref: '#/components/schemas/statusOK'
user:
$ref: '#/components/schemas/thirdPartyUser'
createdNewUser:
$ref: '#/components/schemas/user'
createdNewRecipeUser:
type: boolean
example: true

passwordResetErrorResponse:
type: object
properties:
status:
type: string
enum: ['RESET_PASSWORD_INVALID_TOKEN_ERROR']

passwordResetResponse:
type: object
properties:
status:
type: string
enum: ['OK', 'RESET_PASSWORD_INVALID_TOKEN_ERROR']

enum: ['OK']
user:
$ref: '#/components/schemas/user'
email:
$ref: '#/components/schemas/email'

fieldErrorResponse:
type: object
Expand All @@ -2369,12 +2451,22 @@ components:
type: string
enum: ['WRONG_CREDENTIALS_ERROR']

noEmailGivenByProviderResponse:
type: object
properties:
status:
type: string
enum: ['NO_EMAIL_GIVEN_BY_PROVIDER']
signinupErrorResponse:
oneOf:
- type: object
properties:
status:
type: string
enum: ['NO_EMAIL_GIVEN_BY_PROVIDER' | 'EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT']
rishabhpoddar marked this conversation as resolved.
Show resolved Hide resolved

- type: object
properties:
status:
type: string
enum: ['SIGN_IN_UP_NOT_ALLOWED']
reason:
type: string
example: "Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)"

internalError:
type: string
Expand Down