Protocols/WebAPI/Auth/Client/getInfo: Difference between revisions

From NINA Wiki
Jump to navigation Jump to search
No edit summary
m (AD moved page Protocols/WebAPI/Auth/getInfo to Protocols/WebAPI/Auth/Client/getInfo without leaving a redirect)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Protocols/WebAPI}}
{{Protocols/WebAPI}}


This page is about the getInfo method for [[Protocols/WebAPI/Auth|WebAPI authentication]].
This page is about the getInfo method for [[Protocols/WebAPI/Auth/Client|WebAPI Client]] authentication.


Validates the Authentication Token issued by clientLogin method and returns user's loginId, displayName and the authentication time stamp. This method also provides a way (see 'reqRights' argument below) for the client to obtain user's consent and manage it securely.
Validates the Authentication Token issued by clientLogin method and returns user's loginId, displayName and the authentication time stamp. This method also provides a way (see 'reqRights' argument below) for the client to obtain user's consent and manage it securely.
Line 31: Line 31:
*** Base64 encoded digital signature (HMAC-SHA256) of the request using the Session Key generated as below.
*** Base64 encoded digital signature (HMAC-SHA256) of the request using the Session Key generated as below.
**** Session Key = base64_encode[HMAC-SHA256(key, data)] where key is the user's password and data is the session secret obtained from clientLogin response.
**** Session Key = base64_encode[HMAC-SHA256(key, data)] where key is the user's password and data is the session secret obtained from clientLogin response.
*** Please refer to [[Protocols/WebAPI/Auth/Signing_Requests|Signing Requests]] for information about how to generate signature.
*** Please refer to [[Protocols/WebAPI/Auth/Client/Signing_Requests|Signing Requests]] for information about how to generate signature.


== Response Format ==
== Response Format ==
Line 41: Line 41:
** displayName -- User's Display Name
** displayName -- User's Display Name
** lastAuth -- Seconds since the user was last authenticated
** lastAuth -- Seconds since the user was last authenticated
* redirectURL
* redirectURL -- Redirect URL where the user should be redirected to.


=== The XML standard wrapper ===
=== The XML standard wrapper ===
Line 62: Line 62:
         "statusText":"",
         "statusText":"",
         "statusDetailCode":""
         "statusDetailCode":""
         "requestId":""
         "requestId":""
         "data":{
         "data":{
Line 113: Line 112:
           <userData>
           <userData>
               <loginId>ChattingChuck</loginId>
               <loginId>ChattingChuck</loginId>
               <displayName>Chuck</displayName>
               <displayName>Chuck</displayName>
               <lastAuth>1161932570000</lastAuth>
               <lastAuth>1161932570000</lastAuth>
Line 145: Line 143:
[[Category:AIM]]
[[Category:AIM]]
[[Category:Protocols/WebAPI]]
[[Category:Protocols/WebAPI]]
[[Category:Protocols/WebAPI/Auth]]
[[Category:Protocols/WebAPI/Auth/Client]]
[[Category:Work_In_Progress]]
[[Category:Work_In_Progress]]

Latest revision as of 22:53, 25 March 2020

WebAPI Protocol
Basic
Introduction
Clients
Whimsicals
Host Interaction
Flow
Authentication
Client
WebApp
Other Services
Foodgroups

This page is about the getInfo method for WebAPI Client authentication.

Validates the Authentication Token issued by clientLogin method and returns user's loginId, displayName and the authentication time stamp. This method also provides a way (see 'reqRights' argument below) for the client to obtain user's consent and manage it securely.

Initial Request

  • URL
    • http(s)://api.screenname.nina.bz/auth/getInfo
  • HTTP Method
    • GET or POST
  • Arguments
    • devId (required)
      • your developer Id required to access NINA APIs
    • f (required)
      • the required format of the response (XML, JSON, or the query string)
    • language (optional)
      • the required language and locale of the error/status messages. This is always in "<lang>-<locale>" format. The lang is the 2 letter language code for I18N (default: en) and the locale is the 2 letter Locale code for I18N (default: us). If not passed in, the language will be extracted from HTTP header (Accept-Language) and if that is not available will default to "en-us". Check below for our current supported language list.
    • reqAuthFreshness (optional)
      • required Authentication freshness in secs ( time since the user was last authenticated). Default is 24 hrs (86400 secs)
    • c (optional)
      • the callback method to use when using jsonp convention (argument f = json)
    • r (optional)
      • an URL safe string to be used as requestId - when passed it is returned back in the response
    • a (required)
      • the Authentication token returned by login or getToken methods
    • ts (required)
      • current timestamp in seconds since epoch used to make sure the request cannot be replayed after a few mins
    • sig_sha256 (required)
      • Base64 encoded digital signature (HMAC-SHA256) of the request using the Session Key generated as below.
        • Session Key = base64_encode[HMAC-SHA256(key, data)] where key is the user's password and data is the session secret obtained from clientLogin response.
      • Please refer to Signing Requests for information about how to generate signature.

Response Format

The following data elements would be returned in the response

  • userData
    • loginId -- User's Login Identifier
    • displayName -- User's Display Name
    • lastAuth -- Seconds since the user was last authenticated
  • redirectURL -- Redirect URL where the user should be redirected to.

The XML standard wrapper

       <response>
            <statusCode />
            <statusText />
            <statusDetailCode />
            <requestId />
            <data>
                 ....
            </data>
       </response> 

The JSON standard wrapper

   {"response":{
        "statusCode":""
        "statusText":"",
        "statusDetailCode":""
        "requestId":""
        "data":{
              ....
        } 
   }}

Query String

The following parameters will be returned back as name-value string in URL Query String format (name=value&name=value&...):

  • statusCode
  • statusText
  • statusDetailCode
  • requestId
  • userData_loginId
  • userData_displayName
  • userData_lastAuth
  • redirectURL

Error Codes

  • 200 - Success (Ok)
  • 330 - More authentication required
  • 340 - More rights required
  • 400 - Invalid request
  • 401 - Unauthorized (authentication required)
  • 405 - Method not allowed
  • 408 - Request timeout
  • 430 - Source rate limit reached
  • 440 - Invalid Key
  • 441 - Key usage limit reached
  • 442 - Key invalid IP
  • 443 - Key used from unauthorized site
  • 444 - token used from unauthorized site (Referer doesn't match the value in token)
  • 450 - Rights denied
  • 451 - Permission denied
  • 460 - Missing required parameter
  • 462 - Parameter error
  • 500 - Generic Server Error

Sample Response

XML

    <response xmlns="https://api.login.nina.bz">
        <statusCode>200</statusCode>
        <statusText>OK</statusText>
        <data>
           <userData>
              <loginId>ChattingChuck</loginId>
              <displayName>Chuck</displayName>
              <lastAuth>1161932570000</lastAuth>
           </userData>
        </data>
    </response>

JSON

    {"response":{
        "statusCode":200,
        "statusText":"OK",
        "data":{
            "userData":{
               "loginId":"ChattingChuck",
               "displayName":"Chuck",
               "lastAuth":1161932570000
             }
        } 
     }}

Query String

statusCode=200&statusText=OK&userData_loginId=ChattingChuck&userData_lastAuth=1161932570000