Token Authenticatie Token login

Token authenticatie is gelijk op alle beveiligde onderdelen. Token authenticatie zal verlopen middels een HTTP Basic Auth request. Op elke request behalve OPTIONS zal token authenticatie verwacht worden. Voor de HTTP Aanvragen die effect op het systeem hebben zoals GET, POST, PUT en DELETE wordt HTTP Basic Auth verwacht.

Token gebruiken

Let op

De URLs en tokens gebruikt in de voorbeelden zijn niet te gebruiken.

Voorbeeld (Bash):

                    $  curl -X GET --user "token:q3=d5h9-42ocbrl8@7vj" "https://api.workspace.nl/api/v1/securepage.json"
                

Voorbeeld reactie (PHP):


                    $ch = curl_init();

                    $headers = array(
                        'Accept: application/json',
                        'Content-Type: application/json',
                    );

                    curl_setopt($ch, CURLOPT_URL, 'https://api.workspace.nl/api/v1/securepage.json');
                    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
                    curl_setopt($ch, CURLOPT_HTTPGET, true);
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
                    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                    curl_setopt($ch, CURLOPT_USERPWD, "token:q3=d5h9-42ocbrl8@7vj");

                    $result = curl_exec ($ch);
                    curl_close ($ch);
                    

Voorbeeld reactie (JSON):


                    {
                       "response":
                       {
                           "message": "success",
                           "exception":
                           [
                           ],
                           "code": 200,
                           "data":
                           {
                               "gebruikers":
                               [
                                   {
                                       "Gebruiker":
                                       {
                                           "id": "999999",
                                           "...": "..."
                                       }
                                   },
                                   {}...
                                ]
                            }
                        }
                    }