Skip to content

Client Login

Varun Patil edited this page Mar 18, 2018 · 5 revisions

Call flow of client for login

Replace constants and make a call to https://gymkhana.iitb.ac.in/sso/oauth/authorize/?client_id=CLIENT_ID&response_type=code&scope=basic profile picture sex ldap phone insti_address program secondary_emails&redirect_uri=VALID_REDIRECT_URI

This will redirect to VALID_REDIRECT_URI?code=AUTH_CODE&...

Once you have the auth code, make a call to /api/login?code=AUTH_CODE&redir=VALID_REDIRECT_URI

This will return something like

{
   "user":"6954",
   "sessionid":"0p2ghw27puzh84kaakg4s8qvu1albvkv",
   "profile_id":"2cd8bf5c-eafb-402b-8a04-f62f94ccd58d",
   "profile":{
      "id":"2cd8bf5c-eafb-402b-8a04-f62f94ccd58d",
      "name":"DUMMY NAME",
      "profile_pic":"https://gymkhana.iitb.ac.in/sso/media/profile_picture/eefcdcf2dd674a0ca7be817bcf1d98f6.jpg",
      "events_interested":[],
      "events_going":[],
      "email":"dummy@iitb.ac.in",
      "year":1,
      "roll_no":"160010005",
      "contact_no":"8454954434",
      "about":null,
      "followed_bodies":[],
      "followed_bodies_id":[]
   }
}

Parse this and get sessionid and include it in every subsequent query as a cookie sessionid: SESSION_ID

Get User

The endpoint /api/login/get-user gets this response again for the cookie.

Clone this wiki locally