Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Problem statement:

   Sunbird system will allow user on-boarding with following ways:

  1.   Self sign up
  2.   Google plus login
  3.   State login    

Problem will have during user profile merging. Migrating self sign up user profile with Google plus login or state login.


Note : As create user required phone or email verification by sending OTP, so is our assumption is each adopter will be using sms gateway, if there user want to signup with phone.

User attribute required during sign up:

AttributeTypeRequiredpurpose
namestringtruename of user. can be combination of firstname , middle name and lastname
usernamealphanumericfalseunique identity to identify user. user name will be unique per installation
passwordalphanumerictrue
phonenumberconditionaleither phone or email is mandatory . but during creation time user can't pass both.
emailalphanumericconditionaleither phone or email is mandatory . but during creation time user can't pass both.
userTypestringinternalTo identify user is Teacher or Other , as of now there is only two types
signUpTypestringinternalTo identify user came via selfsignUp, googleplus , statelogin or stateonboard
isPhoneVerifiedbooleaninternalwill be true only when user verified phone otp
isEmailVerifiedbooleaninternalwill be true only when user verified email otp
otpnumberfalseOTP can be passed during signup 

Self sign up work flow:

  •  User will enter all mandatory field (name, phone/email, username,password) on consumer portal/app
  • Consumer will make call for generate OTP for either phone or email
  •  OTP Generation will be taken care by Design for One time password (OTP)
  • Once User enter OTP, consumer will check OTP basic Validation and then it will call create user APi:
  • System will check uniqueness of email/phone , username  and OTP , if every thing is ok then it will create user under sunbird.
  • if any validation fails then it will throw proper error
Create user body
Create User api request body:
URI: v2/user/create
Method: POST
Request body:

{
 "request":
      {
       "firstName":"name of user",
       "email":"valid and unique email id",
       "phone":"valid phone number",
       "password":"user password",
       "username" : "unique user name. Optional",
       "channel" : "rootOrgchannel value (Optional)"// if user pass it , it must be valid and user will be associated with this as "PUBLIC" role.
       "organisationId": "",
       "OTP":"entered OTP by user(optional)",
       "VerificationType":"it can be OTP , Google , or some state"  
         
    }
}

Note:
* Now user creation won't ask user to enter phoneVerified, if user is providing phone number.
* is username is auto generated unique value or user has to enter it - it's optional for user , if user not providing then system will generate it.
* Do we need to take orgId or channel in create user to associate user with another rootOrg?
* How to do validation for Indian phone number. As per PRD only Indian phone number is valid.
* Are we taking country code as well from user , or always will associate user country code as "+91"
* Do we need to make OTP mandatory or optional based on introducing signupType?

Storage of user data pre-user creation:

   Requirement is sunbird should not create user into system unless or until it's verified. 

Proposed solution 1:

          Consumer (portal/app) can hold user data in local cache , and  once OTP is verified then only they make create user api call.


ProsCons
  1. Junk data won't be in system.
  2. System will always has verified user account.
  1. if you refresh cache or clear cache that might clear user store data.


   

Proposed solution 2: 

  User Data can be stored under sunbird as some temp table or inside OTP table as well, and once user verify OTP then , it will move data from temp to user table.

ProsCons
  1. All attempted user data is in sunbird
  1. it will have lot of unverified profile in sunbird. 

Proposed solution 3: 

  Sunbird can introduce Redis service and all unverified user data can be stored under Redis.This service can be used for other centralized cache as well.

ProsCons
  1. Data lost issues can be resolved
  2. Sunbird will have all verified and un-verifed data.
  3. Redis cache can be used in other places as well. As of now sunbird is doing in-memory cache of some data , and that will vary from server to server.
  1. Implementation time will be more.
  2. Need to manage one more stack


Google sign In:

 When user come to sunbird via Google sign in , Caller will do following check.

  •  If user already exist in sunbird  and user status is not deleted , then allow that user to do login.
  •  If user does not exist in sunbird then make below api call 
URI: 
Method: POST
Request body: 

 {
  "request": {
       "firstName":"",
       "email":"",
       "loginType":"",
       "verificationKey":"id_token in case of Google",
      }
}

Response: 
  same as create user api

* This api will do following validation:
   1.  Make Google api call by appending verificationkey in URL  as follows:
 https://www.googleapis.com/oauth2/v3/tokeninfo?id_token={verificationKey}
   2. once verified then it will make create user api call to create a user once user is created his/her email  verified field will be true.


State sign-in

When user comes through state-portal, he/she will get a link to access Diksha portal.

  1. Once user clicks, internally user will check existence of the user in the diksha
  2. If found then user will be directly taken to the Diksha portal, through trampoline update.
  3. If not found, then we will invoke the user sing-up process, by reading the data from existing JWT token.
  4. OTP will be generated and sent to user's mobile phone. OTP Generation will be taken care by Design for One time password (OTP)
  5. On diksha user will be redirected to Enter OTP - for first time login.
  6. On successful OTP validation, user will be created within Diksha and user will be logged into the platform.


Create user body
Create User api request body:
URI: v2/user/create
Method: POST
Request body:

{
 "request":
      {
       "firstName":"name of user",
       "phone":"valid phone number",
       "username" : "auto-generated username",
       "channel" : "rootOrgchannel value (Optional)"// if user pass it , it must be valid and user will be associated with this as "PUBLIC" role.
       "organisationId": "",
       "OTP":"entered OTP by user" 
         
    }
}

** Open Questions:

  1. What should be userName in this case? (As discussed username will be auto-generated - internally system will make sure that auto-generated username will be related to user and not very hard to remember.)
  2.  Does system need to generate password for Google signup user? (As per discussion , no need to generate password.)
  3. Do we need to send any welcome email to user? if yes then what should be content? (As per discussion, for Google user creation no need to send any email.)
  4. What will happen if some old Google user won't have firstName or name itself?
  5. There might be scenario user already exist but his status is deleted? (As per discussion, user creation will fail.)
  6. Do we need to carry loginId as well?
  7. In Old implementation during user create we have to send phoneVerified as true?
  • No labels