|
|
Line 7: |
Line 7: |
| == Stage 1: Initial Authorization == | | == Stage 1: Initial Authorization == |
|
| |
|
| Over the years, the NINA/ICQ/AIM backend has supported several different methods for authentication. Until the NINA project began taking over the responsibility for the OSCAR protocol, the only publicly supported login method was clientLogin. We actually support ''all'' authentication methods, even legacy ones, in order to support the full range of clients. | | Over the years, the NINA/ICQ/AIM backend has supported several different methods for authentication. Until the NINA project began taking over the responsibility for the OSCAR protocol, the only publicly supported login method was clientLogin. |
|
| |
|
| === FLAP ===
| | We actually support ''all'' authentication methods, even legacy ones, in order to support the full range of clients. Due to complexity and level of detail, each method had been separated into sub-articles. |
|
| |
|
| This refers to the FLAP__FRAME_SIGNON authentication method for a user to authenticate to the network. This works similar to, but is not the same as, FLAP__FRAME_SIGNON sequences used to connect to BOS and other services.
| | ;[[Protocols/OSCAR/Sign_On/FLAP|FLAP]] |
| | | : This is the oldest method of sign on, used prior to AIM 3.5. It is not to be confused with the FLAP-level sign on for BOSS and other services. |
| Next steps:
| | ;[[Protocols/OSCAR/Sign_On/BUCP|BUCP]] |
| * [[Protocols/OSCAR/Sign_On#Stage_2:_Connecting_to_BOSS|Connecting to BOSS]]
| | : This method is used from AIM 3.5 to AIM 5.9, for ICQ, and can be wrapped in TLS. |
| | | ;[[Protocols/OSCAR/Sign_On/UAS|UAS]] |
| === BUCP ===
| | ; Kerberos-based authentication is used in AIM 6+. |
| | | ;[[Protocols/OSCAR/Sign_On/clientLogin|clientLogin]] |
| Next steps:
| | : This web-based login can be used by both OSCAR clients and [[Protocols/WebAPI|WebAPI]] clients. |
| * [[Protocols/OSCAR/Sign_On#Stage_2:_Connecting_to_BOSS|Connecting to BOSS]]
| |
| | |
| === UAS ===
| |
| | |
| Next steps:
| |
| * [[Protocols/OSCAR/Sign_On#Stage_2:_Connecting_to_BOSS|Connecting to BOSS]]
| |
| | |
| === clientLogin ===
| |
| | |
| The clientLogin method allows the client to collect the user name and password and make a simple web service call to retrieve authentication credentials. These credentials are then used in future web service calls to sign requests to help against man in the middle and reply attacks.
| |
| | |
| Authentication and requesting the BOSS connection normally requires two web service calls.
| |
| | |
| # The [[Protocols/WebAPI/Auth/Client|clientLogin]] call checks the key, loginId, and password and performs any rate limit or captcha challenges
| |
| # The [[Protocols/WebAPI/Reference/Methods/Session#startOSCARSession|startOSCARSession]] call requests a BOSS connection and returns where the client needs to connect to and a one time use cookie to present to the BOSS server for authentication. This call requires an OAuth style URL signing which is described along with [[Protocols/WebAPI/Auth/Client|clientLogin]]. ''URL signing requires the computers clock to be accurate or the use of hostTime returned by clientLogin, parameters are in [http://oauth.net/core/1.0/#sig_norm_param alphabetical order], and [http://oauth.net/core/1.0/#encoding_parameters percent-encoding] uses upper case characters.''
| |
| | |
| Here is an example of the sign on process:
| |
| | |
| ==== Step #1 - Authentication Request ====
| |
| | |
| The client should collect the loginId and password for the user. It should not do any length or character validations. A POST web service call should be made to:
| |
| <pre>https://api.screenname.nina.bz/auth/clientLogin?f=[FORMAT]</pre>
| |
| ...with a POST body of...
| |
| <pre>k=[KEY]&s;=[LOGINID]&pwd;=[PASSWORD]&clientVersion;=[CLIENTVERSION]&clientName;=[clientName]</pre>
| |
| ...and a content type of '''application/x-www-form-urlencoded''' with the following values:
| |
| | |
| ; [FORMAT]
| |
| : Format to return the response in; XML, AMF3, PHP, JSON are all supported
| |
| ; [KEY]
| |
| : Client key obtained from [https://dev.nina.bz/webapi/keys/manage/ here]
| |
| ; [LOGINID]
| |
| : URI encoded loginId entered by the user
| |
| ; [PASSWORD]
| |
| : URI encoded password entered by the user
| |
| ; [clientVersion]
| |
| : A single number representing the client version number for metrics and tracking, usually the build number
| |
| ; [clientName]
| |
| : URI encoded friendly name representing the client being used
| |
| | |
| '''Example:'''
| |
| | |
| URL:
| |
| <pre>
| |
| https://api.screenname.nina.bz/auth/clientLogin?f=xml
| |
| </pre>
| |
| POST Data:
| |
| <pre>
| |
| k=thekey&s;=chattingChuck&pwd;=WeakPassword&clientVersion;=3&clientName;=Cool+Client
| |
| </pre>
| |
| | |
| Assuming correct loginId, password, and no CAPTCHA challenge, a good response will look like the following:
| |
| | |
| <pre>
| |
| <response xmlns="https://api.login.nina.bz">
| |
| <statusCode>200</statusCode>
| |
| <statusText>OK</statusText>
| |
| <data>
| |
| <token>
| |
| <expiresIn>86400</expiresIn> <a>%2FwEAAAAAm3uC7kLggQUTUxDaptz5ddrYlsBinH5jBpi3aKVFOwRZUdy4VC3HBXkdtUaFOTM8E9og492eGQi3X0cIrwRfN5SsuA%2BE9nGhXtbQt%2BHoaa8Fw9yMTuuuks3%2F8ZRh0IyGOaLWhQssgtB3vEoEEQPSc4ZZcUARXm0b3GBfEW5E3QGjTvi6tRPsVpmnfSQ%3D</a>
| |
| </token>
| |
| <sessionSecret>m3UPFGcH5hmKSv24</sessionSecret>
| |
| </data>
| |
| </response>
| |
| </pre>
| |
| | |
| Extract the token->a and sessionSecret elements and save for later.
| |
| | |
| ==== Step #2 - Authentication Reply ====
| |
| | |
| There can be several intermediate replies before a successful authentication is completed. These include incorrect passwords, need for extra credentials, or the need for the user to complete a CAPTCHA challenge. To test if a client supports CAPTCHA challenges correctly it can add an extra parameter of '''forceRateLimit=true'''. ''It is recommended that all clients test CAPTCHA support.''
| |
| | |
| When successfully authenticated, the token->a and sessionSecret need to be extracted from the results (see Step #1). The sessionSecret is used to generate a sessionKey that will be used on future calls. For example, the startOSCARSession service, the start page, and the expressions page all require the sessionKey.
| |
| | |
| The sessionKey is calculated using:
| |
| <pre>sessionKey = hmac_sha256_base64($sessionSecret, $password);</pre>
| |
| | |
| For example, if the sessionSecret was "AB123FO" and the user's password was "weakpassword", then the sessionKey would be "ZyCaA1QlF8oBzh0QXeXNCf+7qUItBaiXwk3xOVcFZhY=" Historically some hmac_sha256_base64 do not return valid base64 data. All these APIs require valid base64 data, so check the implementation being used.
| |
| | |
| '''Example:''' This example is based on this and the previous step.
| |
| | |
| <pre>
| |
| $sessionKey = hmac_sha256_base64("m3UPFGcH5hmKSv24", "WeakPassword");
| |
| </pre>
| |
| | |
| It will look something like:
| |
| | |
| <pre>
| |
| $sessionKey = "wEOki901gedaIeJbMAy5k+hv4iJgfvshgM+cWtk+s1g=";
| |
| </pre>
| |
| | |
| ==== Step #3 - Start OSCAR Session Request ====
| |
| | |
| Once successfully authenticated, the client needs to connect to the BOSS server to start the AIM session. This is done by requesting a BOSS reservation and then connecting to the BOSS server. Requesting the BOSS reservation is done with a [[Protocols/WebAPI/Reference/Methods/Session#startOSCARSession|startOSCARSession]] WIM call.
| |
| | |
| This call requires an OAuth style URL signing which is described along with [[Protocols/WebAPI/Auth/Client|clientLogin]]. ''URL signing requires the computers clock to be accurate or the use of hostTime returned by clientLogin, parameters are in [http://oauth.net/core/1.0/#sig_norm_param alphabetical order], and [http://oauth.net/core/1.0/#encoding_parameters percent-encoding] uses upper case characters.'' | |
| | |
| ; [FORMAT]
| |
| : Format to return the response in: XML, AMF3, PHP, JSON are all supported
| |
| ; [KEY]
| |
| : Client key obtained from [https://dev.nina.bz/webapi/keys/manage/ here]
| |
| ; [TOKEN]
| |
| : The URI encoded token extracted from clientLogin
| |
| ; [clientVersion]
| |
| : A single number representing the client version number for metrics and tracking
| |
| ; [clientName]
| |
| : A URI encoded friendly name representing the client being used
| |
| ; [TIME]
| |
| : The current time, in seconds, since UNIX EPOCH
| |
| ; [USETLS]
| |
| : Should the connection to BOSS use TLS
| |
| | |
| <pre>
| |
| $uri = "http://api.oscar.nina.bz/aim/startOSCARSession";
| |
| $queryString = "a=[TOKEN]&clientName;=CLIENTNAME]&clientVersion;=[CLIENTVERSION]&f;=[FORMAT]&k;=[KEY]&ts;=[TIME]&useTLS;=[USETLS]";
| |
| $hashData= "GET&" . uri_encode($uri) . "&" . uri_encode($queryString);
| |
| $digest = hmac_sha256_base64($hashData, $sessionKey);
| |
| $url = $uri . "?" . $queryString . "&sig;_sha256=$digest";
| |
| </pre>
| |
| | |
| The above will look something like this:
| |
| | |
| <pre>
| |
| $uri = "http://api.oscar.nina.bz/aim/startOSCARSession";
| |
| $queryString = "a="
| |
| . uri_encode("%2FwEAAAAAm3uC7kLggQUTUxDaptz5ddrYlsBinH5jBpi3aKVFOwRZUdy4VC3HBXkdtUaFOTM8E9og492eGQi3X0cIrwRfN5SsuA"
| |
| . "%2BE9nGhXtbQt%2BHoaa8Fw9yMTuuuks3%2F8ZRh0IyGOaLWhQssgtB3vEoEEQPSc4ZZcUARXm0b3GBfEW5E3QGjTvi6tRPsVpmnfSQ%3D")
| |
| . "&clientName;=" . uri_encode("Cool Client")
| |
| . "&clientVersion;=3&f;=xml&k;=thekey&ts;=1203799990";
| |
| $hashData= "GET&" . uri_encode($uri) . "&" . uri_encode($queryString);
| |
| $digest = hmac_sha256_base64($hashData, $sessionKey);
| |
| $url = $uri . "?" . $queryString . "&sig;_sha256=$digest";
| |
| // The above $url may also have the parameter of _sha25sig_sha256 instead of the client so chooses.
| |
| </pre>
| |
| | |
| The above variables should have the values that look something like:
| |
| | |
| <pre>
| |
| $queryString = "a=%252FwEAAAAAm3uC7kLggQUTUxDaptz5ddrYlsBinH5jBpi3aKVFOwRZUdy4VC3HBXkdtUaFOTM8E9og492eGQi3X0cIrwRfN5SsuA%252BE9nGhXtbQt%252BHoaa8Fw9yMTuuuks3%252F8ZRh0IyGOaLWhQssgtB3vEoEEQPSc4ZZcUARXm0b3GBfEW5E3QGjTvi6tRPsVpmnfSQ%253D&clientName;=Cool%20Client&clientVersion;=3&f;=xml&k;=thekey&ts;=1203799990";
| |
| | |
| $hashData = "GET&http;%3A%2F%2Fapi.oscar.aol.com%2Faim%2FstartOSCARSession&a;%3D%25252FwEAAAAAm3uC7kLggQUTUxDaptz5ddrYlsBinH5jBpi3aKVFOwRZUdy4VC3HBXkdtUaFOTM8E9og492eGQi3X0cIrwRfN5SsuA%25252BE9nGhXtbQt%25252BHoaa8Fw9yMTuuuks3%25252F8ZRh0IyGOaLWhQssgtB3vEoEEQPSc4ZZcUARXm0b3GBfEW5E3QGjTvi6tRPsVpmnfSQ%25253D%26clientName%3DCool%2520Client%26clientVersion%3D3%26f%3Dxml%26k%3Dthekey%26ts%3D1203799990";
| |
| | |
| $digest = "WrxLjKmMfXpM3beElxc5HpARu/yuoMX4pvhVW2T6B+w=";
| |
| | |
| $url = "http://api.oscar.aol.com/aim/startOSCARSession?a=%252FwEAAAAAm3uC7kLggQUTUxDaptz5ddrYlsBinH5jBpi3aKVFOwRZUdy4VC3HBXkdtUaFOTM8E9og492eGQi3X0cIrwRfN5SsuA%252BE9nGhXtbQt%252BHoaa8Fw9yMTuuuks3%252F8ZRh0IyGOaLWhQssgtB3vEoEEQPSc4ZZcUARXm0b3GBfEW5E3QGjTvi6tRPsVpmnfSQ%253D&clientName;=Cool%20Client&clientVersion;=3&f;=xml&k;=thekey&ts;=1203799990&sig;_sha256=WrxLjKmMfXpM3beElxc5HpARu/yuoMX4pvhVW2T6B+w=";
| |
| </pre>
| |
| | |
| '''Assuming no errors, a reply like the following should be received: '''
| |
| | |
| <pre>
| |
| <response xmlns="http://developer.nina.bz/xsd/aim.xsd">
| |
| <statusCode>200</statusCode>
| |
| <statusText>Ok</statusText>
| |
| <data>
| |
| <host>192.168.1.1</host>
| |
| <port>9343</port> <cookie>yoOR9mTV9hGH2vHNXtDytoHTu4q/yYpzkQzrs9L0GKg9ePe29nfS6J0+mIJD0ibMndzjde1AsumqQ6q+1pW95IyNHIhLxDm0PKF+aV8Mg05WZ7guQwiaNGPGXOq5qHI4kIyuVFU1kb9suwStkn+awsySalirJvTJbnbws2RqEV7MsBNF99MUJl+PEHuvEtqAAPuq0HvUGiFqPLC25D+cTYFmLMRwoQPtqIaHHAlaxo+kSWDTAKLzXGZ1JS/6Jd1p2HqPaBjCXuawVFpbwJT+DepJojJHGA4YMGh+YxM8dIfG8IH28w3/cqMZB/RDKaqZX+p0/AH4eqg34+BtYrfq/g==</cookie>
| |
| </data>
| |
| </response>
| |
| </pre>
| |
| | |
| ==== Step #4 - Start OSCAR Session Reply ====
| |
| | |
| On a successful startOSCARSession, the backend will return where the BOSS server is running, the cookie to present to the BOSS server, and the certname that should be validated when connecting to BOSS if TLS was selected. At this point the client should connect to BOSS using FLAP or FLAP over TLS and start sending SNACs back and forth.
| |
| | |
| '''BE SURE''' to decode (base64) the cookie value ''before'' sending it in the next step.
| |
| | |
| Next steps:
| |
| * [[Protocols/OSCAR/Sign_On#Stage_2:_Connecting_to_BOSS|Connecting to BOSS]]
| |
| * [[Protocols/WebAPI/Single_Sign_On_to_Web_Pages|Single Sign On to Web Pages]] Tutorial
| |
| * [[Protocols/WebAPI/Start_Page_and_Expression_Chooser|Start Page and Expression Chooser]] Tutorial
| |
|
| |
|
| == Stage 2: Connecting to BOSS == | | == Stage 2: Connecting to BOSS == |
NINA clients (AIM, ICQ, et al) have several ways to authenticate and sign on to the network. While AOL may have discontinued all legacy methods, we have brought them back so that all clients and other software that may interact with the network will be fully functional.
This page provides an overview of all of the available methods, primarily from the perspective of the sequence of events and linking to pages with further information.
Stage 1: Initial Authorization
Over the years, the NINA/ICQ/AIM backend has supported several different methods for authentication. Until the NINA project began taking over the responsibility for the OSCAR protocol, the only publicly supported login method was clientLogin.
We actually support all authentication methods, even legacy ones, in order to support the full range of clients. Due to complexity and level of detail, each method had been separated into sub-articles.
- FLAP
- This is the oldest method of sign on, used prior to AIM 3.5. It is not to be confused with the FLAP-level sign on for BOSS and other services.
- BUCP
- This method is used from AIM 3.5 to AIM 5.9, for ICQ, and can be wrapped in TLS.
- UAS
- Kerberos-based authentication is used in AIM 6+.
- clientLogin
- This web-based login can be used by both OSCAR clients and WebAPI clients.
Stage 2: Connecting to BOSS
Connect to the host and port (optionally over TLS) provided in the previous step, regardless of the method it was obtained.
Step #1 - Send FLAP SIGNON Frame
Once connected, the client should send a FLAP__FRAME_SIGNON with the login cookie and any version information it would like to provide.
Field
|
Size
|
Value
|
u08
|
flapHeader.startMarker
|
'*'
|
u08
|
flapHeader.frameType
|
0x01 (FLAP__FRAME_SIGNON)
|
u16
|
flapHeader.sequenceNumber
|
XX
|
u16
|
flapHeader.payloadLength
|
YY
|
u32
|
version
|
0x01
|
u16
|
tlvs[0].tag
|
0x06 (FLAP__SIGNON_TAGS_LOGIN_COOKIE)
|
u16
|
tlvs[0].len
|
0x100
|
blob
|
tlvs[0].value
|
base64 decoded $cookie value from Step #2
|
u16
|
tlvs[1].tag
|
0x4A (OSERVICE__MULTICONN_FLAGS)
|
u16
|
tlvs[1].len
|
0x01
|
u08
|
tlvs[1].value
|
0x01
|
- It should then listen for a FLAP__FRAME_SIGNON from BOSS before continuing.
- Once it has received the FLAP__FRAME_SIGNON, the client can start sending SNAC messages to the server.
Stage 3: Going Online
Once the connection has been established and the FLAP signon frames have been exchanged, the client can start sending SNACs to the server.
Step 1: Rights Requests
Usually the first thing the client sends are all the rights queries and a FEEDBAG__QUERY SNAC. It can and should send all these requests in parallel for a quicker login experience.
- Client queries the BUDDY foodgroup for rights: BUDDY__RIGHTS_QUERY
- Query the PD foodgroup rights: PD_RIGHTS_QUERY
- Query the LOCATE foodgroup rights: LOCATE_RIGHTS_QUERY
- Query the FEEDBAG foodgroup rights: FEEDBAG_RIGHTS_QUERY
- Query what the Buddy List and preferences are: FEEDBAG_QUERY
Step 2: FEEDBAG Use and Client Online
Once all the rights replies and feedbag replies are received, it is time to tell the server that the client is ready to proceed.
- First tell the server that the feedbag looks OK and the client is ready to use it: FEEDBAG_USE
- Next we tell the client we are ready to appear online to everyone else and our version numbers: OSERVICE_CLIENT_ONLINE
Step 3: Online
The client is now considered online, visible to other users, and will start to receive BUDDY__ARRIVED for any online buddies.
Next steps:
FLAP Login Sign On Errors (Temp)
Standard Format Login Errors during Phase 1
These occur in response to the initial Phase 1 login command sent from the client. All Standard Format login errors follow this format. This error command is always in the Command Family 0x04. All variable-length strings are assumed to be 1 byte long when doing position numbers.
Position
|
Data Size
|
Data
|
1
|
Word
|
0x0001
|
3
|
Word
|
Screen Name Length (not including null)
|
5
|
ASCIIZ String
|
Screen Name that failed (null-terminated)
|
6
|
Byte
|
0x04
|
7
|
Word
|
Error Message URL Length (not including null)
|
9
|
ASCIIZ String
|
Error Message URL (null-terminated)
|
10
|
Byte
|
0x08
|
11
|
Byte
|
0x00
|
12
|
Byte
|
0x02
|
13
|
Word
|
Specific Error Code
|
The current list of known "Specific Error Code"s:
TLV Class: FLAP__SIGNON_TAGS
These tags are used in the FLAP signon frame to BOS. They appear right after the 4 byte version number.
@MAKE NOTE: Difference between ones used if BUCP is in use and ones if clientLogin or w/e was used
Name
|
Tag
|
Type
|
Notes
|
OSERVICE__TLV_TAGS_CLIENT_IDENTITY
|
0x03
|
string
|
Yet another client name
|
OSERVICE__TLV_TAGS_LOGIN_COOKIE
|
0x06
|
blob
|
Login cookie returned by startOSCARSession
|
OSERVICE__TLV_TAGS_MAJOR_VERSION
|
0x17
|
uint16 (word)
|
Client major version: (1) if the client version is "1.2.3"
|
OSERVICE__TLV_TAGS_MINOR_VERSION
|
0x18
|
uint16 (word)
|
Client minor version: (2) if the client version is "1.2.3"
|
OSERVICE__TLV_TAGS_POINT_VERSION
|
0x19
|
uint16 (word)
|
Client minor version: (3) if the client version is "1.2.3"
|
OSERVICE__TLV_TAGS_BUILD_NUM
|
0x1A
|
uint16 (word)
|
Client build number, usually monotonically increasing
|
OSERVICE__TLV_TAGS_MULTICONN_LEVEL
|
0x4A
|
uint8 (byte)
|
[Class: OSERVICE__MULTICONN_FLAGS] Should almost always be 0x01
|
OSERVICE__TLV_TAGS_CLIENT_RECONNECT
|
0x94
|
uint8 (byte)
|
Client claims it is reconnecting because it got knocked off
|
Class: OSERVICE__MULTICONN_FLAGS
These flags control how multiple instances are handled by the servers and if current sessions need to be bumped off when a new session signs on.
Name
|
Value
|
Notes
|
OSERVICE__MULTICONN_LEVEL_OLD_CLIENT
|
0x00
|
Don't use
|
OSERVICE__MULTICONN_LEVEL_MULTI
|
0x01
|
This is a recent client that understands multiple instances
|
OSERVICE__MULTICONN_LEVEL_SINGLE
|
0x03
|
This is a recent client that understands multiple instances but does not want them
|