From eda0a563ef4a9570a527decbab742113274eae6b Mon Sep 17 00:00:00 2001 From: Julian Gojani Date: Fri, 4 Jun 2021 15:43:48 +0200 Subject: [PATCH] Added .http files --- .gitignore | 1 + http/README.md | 13 +++++ http/authentication.http | 62 ++++++++++++++++++++++ http/authkey.http | 11 ++++ http/contacts.http | 37 +++++++++++++ http/developer_center.http | 10 ++++ http/example.png | Bin 0 -> 1514 bytes http/http-client.private.env.example.json | 14 +++++ http/iaauth.http | 47 ++++++++++++++++ http/oauth2.http | 40 ++++++++++++++ http/user.http | 37 +++++++++++++ 11 files changed, 272 insertions(+) create mode 100644 http/README.md create mode 100644 http/authentication.http create mode 100644 http/authkey.http create mode 100644 http/contacts.http create mode 100644 http/developer_center.http create mode 100644 http/example.png create mode 100644 http/http-client.private.env.example.json create mode 100644 http/iaauth.http create mode 100644 http/oauth2.http create mode 100644 http/user.http diff --git a/.gitignore b/.gitignore index e5cec75..81f827c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target *.iml *.env +http-client.private.env.json diff --git a/http/README.md b/http/README.md new file mode 100644 index 0000000..da92afc --- /dev/null +++ b/http/README.md @@ -0,0 +1,13 @@ +# Accounts .http files +This folder includes multiple IntelliJ .http files which you can execute in JetBrains IDEs. + +## Setup +Rename `http-client.private.env.example.json` to `http-client.private.env.json` + +Set in the environment file authkey to your access-token. +### Getting Access-Token +If you want to get your access token just for testing just go to accounts.interaapps.de, open the javascript console and enter `localStorage["authkey"]` and use the given string. + +Read more about getting access tokens: https://developers.interaapps.de/docs/accounts/header + +> Feature missing which you can use in the frontend? Just go into your webbrowser -> press F12 (Dev-Console) -> Go to network and just look what is getting sent diff --git a/http/authentication.http b/http/authentication.http new file mode 100644 index 0000000..24239fe --- /dev/null +++ b/http/authentication.http @@ -0,0 +1,62 @@ +# NOTE: Those requests could change every day because of some added security features or other reasons. + +### Register a user +POST https://accounts.interaapps.de/api/v2/auth/register +Authorization: Bearer {{authkey}} +Content-Type: application/json + +{ + "name": "{{name}}", + "password": "{{password}}", + "mail": "{{email}}", + "privacy_policies_accepted": false, + "profile_picture": "" +} + +### Preview a user by username +GET https://accounts.interaapps.de/api/v2/auth/user_preview?name=TestNutzer +Authorization: Bearer {{authkey}} + +### Login into a user +POST https://accounts.interaapps.de/api/v2/auth/login +Authorization: Bearer {{authkey}} +Content-Type: application/json + +{ + "name": "{{name}}", + "password": "{{password}}" +} + + +### Verify E-Mail +GET https://accounts.interaapps.de/api/v2/auth/verify_mail/{key} +Authorization: Bearer {{authkey}} + +### OAuth2-Login callback +GET https://accounts.interaapps.de/api/v2/auth/oauthlogin/GOOGLE?code=123 +Authorization: Bearer {{authkey}} + +### Auth-Verify (2FA, etc.) +POST https://accounts.interaapps.de/api/v2/authentication_methods/verify/{type} +Authorization: Bearer {{authkey}} +Content-Type: application/json + +{ + "code": "123546" +} + +### Get Authentication-Methods +GET https://accounts.interaapps.de/api/v2/authentication_methods +Authorization: Bearer {{authkey}} +Content-Type: application/json + +### Add/Update Authentication-Method +PUT https://accounts.interaapps.de/api/v2/authentication_methods/method/{type} +Authorization: Bearer {{authkey}} +Content-Type: application/json + +{} + +### Remove Authentication-Method +DELETE https://accounts.interaapps.de/api/v2/authentication_methods/method/{type} +Authorization: Bearer {{authkey}} diff --git a/http/authkey.http b/http/authkey.http new file mode 100644 index 0000000..630f363 --- /dev/null +++ b/http/authkey.http @@ -0,0 +1,11 @@ +### Getting auth-keys +# Permission: authkeys:read +GET https://accounts.interaapps.de/api/v2/authkeys +# ?filter=LOGIN // Show only LOGIN Access-Tokens and not OAuth2 tokens or other +Authorization: Bearer {{authkey}} + + +### Delete auth-key +# Permission: authkeys:delete +DELETE https://accounts.interaapps.de/api/v2/authkeys/{authkey} +Authorization: Bearer {{authkey}} diff --git a/http/contacts.http b/http/contacts.http new file mode 100644 index 0000000..825d69d --- /dev/null +++ b/http/contacts.http @@ -0,0 +1,37 @@ +### Getting contacts + +# contacts.accepted:read +GET https://accounts.interaapps.de/api/v2/contacts +Authorization: Bearer {{authkey}} + +### Get Contact by userId. (Usualy for cheking if contacted) +# contacts.accepted:read +GET https://accounts.interaapps.de/api/v2/contacts/405 +Authorization: Bearer {{authkey}} + +### Deleting contact +# contacts:delete +DELETE https://accounts.interaapps.de/api/v2/contacts/requests/{i+:id} +Authorization: Bearer {{authkey}} + +### Getting contact-requests +# contacts.incoming:read +GET https://accounts.interaapps.de/api/v2/contacts/requests +Authorization: Bearer {{authkey}} + + +### Accepting contact-request +# contacts.incoming:accept +GET https://accounts.interaapps.de/api/v2/contacts/requests/{i+:id}/accept +Authorization: Bearer {{authkey}} + + +### Create contact-request +# contacts.incoming:read +POST https://accounts.interaapps.de/api/v2/contacts +Authorization: Bearer {{authkey}} +Content-Type: application/json + +{ + "name": "NAME" +} diff --git a/http/developer_center.http b/http/developer_center.http new file mode 100644 index 0000000..a8a41c8 --- /dev/null +++ b/http/developer_center.http @@ -0,0 +1,10 @@ +### Get the users projects +# Permission: developers.projects:read +GET https://accounts.interaapps.de/api/v2/projects +Authorization: Bearer {{authkey}} + +### Get a project +# Permission: developers.projects:read +GET https://accounts.interaapps.de/api/v2/projects/{project_id} +Authorization: Bearer {{authkey}} + diff --git a/http/example.png b/http/example.png new file mode 100644 index 0000000000000000000000000000000000000000..214268b4ed8b560bdd91185c4406de5989defa6a GIT binary patch literal 1514 zcmchX`#aMM9LK+_S##@bIxb;}tq@D1adHVQm)v76BSU6kWaYN@xIPDYBzlNM7tT05 zD@<)UZbdl6B!yBrpN^5j|)yD;0OT5;+tLA^x}OmT#MybkNxuY1kR0Y>`$;4sv_5}sv= z{O^h%{Bv^xK@BZEUF_%Y|NTi@Tif==@-ov?KQ=0=-cy)HBobd9VD}eujuWU_T3Yu< zGgjC)IQ!n#6tI#4$@{r|r7RM!NlicR^U0Yb=__ zdiHFm{t}&+FTv9`UE4A{=eMr%$Hs8OJT7;`+{3QCx$yLLJ*dgA^w;ur@($eT>FMo_ znVGQYuekeCkw~;I&_Hp+<27IcUOQe3x2H|;yrg^Z9@;7Bq8Y{@{p!_8Ap(IQwz=&E z8;YX3*$OL2n)AFZxFK6m0crNUFz`v`sENtyYH#nEryU*Bv9Ym<78VvbE8|ph-QM=j z&PeGC9PL!%Xhxz`DjiGme$^V{dM9ARB<`$Ot+njSivom>j&x&cB3J-(r}ZZv1EL@T z8pKti6X@D;rF0E(?#qhdj?he$< zG7dvR8EmHBuJ^9t8GDhQo}Sb!%5rdn-sIpy$@v9lbin@L0bJta5fl{hwmE0kVwJ#y zj<#HEIS(4r)wx&WO)|P$&jfERgmzUms`mKi!$22Z|LUkW5g*5Y@EY`+_`G|+)a|#LyOwluj zL6a!v1q%}9>`SlQg7NVxo9@qvI{HRUQ4*Wd28z#wSuSjG@F?|UCbOQQoj#^sv5ipF zDTsCuuGX%u={#AtxINDcheWENzESlO{@qLwpKcve*lR#o_=>}(7@$l`CR8Y@EN5|1 z>>1J+Ml042+}bnFoclhI=60hy0%aM)doc6&{G-C9g~f(BLt%0?9pfp*`o_ThJ3-N6 z7W_Qd>!8=GUc_P4@~=VG0fM#&k;UBZ8}=g zg}j^(Kx_J&SMX$RafC>ElS)DNYmnpOBvO3WqESpt%x}uN0f*4LgAOFZpPs1X56$Xi zkJ!>Ow!N$6BnL!6o1$mdy&P98jbum5@l&PIw^CD;WU#^-5B`tXlA-aN+^4D9vp0sI Rbuu&qE@wQj4Gy7M{{WRx!OZ{w literal 0 HcmV?d00001 diff --git a/http/http-client.private.env.example.json b/http/http-client.private.env.example.json new file mode 100644 index 0000000..8daeca2 --- /dev/null +++ b/http/http-client.private.env.example.json @@ -0,0 +1,14 @@ +{ + "dev": { + "authkey": "", + "oauth2_client_id": "", + "oauth2_client_secret": "", + "oauth2_code": "", + "iaauth_key": "", + "iaauth_userkey": "", + "iaauth_friend": "", + "name": "", + "password": "", + "email": "" + } +} diff --git a/http/iaauth.http b/http/iaauth.http new file mode 100644 index 0000000..8b91db6 --- /dev/null +++ b/http/iaauth.http @@ -0,0 +1,47 @@ +# IAAuth is not available for other projects. It's just an old internal authorization standard. Use OAuth2. + +###### Frontend + +### Get authorized IAAuth Apps +GET https://accounts.interaapps.de/api/v2/iaauth/authorized_apps +Authorization: Bearer {{authkey}} + +### Get IAAuth App +GET https://accounts.interaapps.de/api/v2/iaauth/app/4 +Authorization: Bearer {{authkey}} + + +### Granting IAAuth App +GET https://accounts.interaapps.de/api/v2/iaauth/app/4/grant +Authorization: Bearer {{authkey}} + +## App + +### Getting user information +POST https://accounts.interaapps.de/iaauth/api/getuserinformation +Content-Type: application/json + +{ + "key": "{{iaauth_key}}", + "userkey": "{{iaauth_userkey}}" +} + +### Check if someone is friend +POST https://accounts.interaapps.de/iaauth/api/friends/isfriend +Content-Type: application/json + +{ + "key": "{{iaauth_key}}", + "userkey": "{{iaauth_userkey}}", + "name": "{{iaauth_friend}}" +} + +### Find user +POST https://accounts.interaapps.de/iaauth/api/finduser +Content-Type: application/json + +{ + "key": "{{iaauth_key}}", + "userkey": "{{iaauth_userkey}}", + "query": "[[\"name\", \"LIKE\", \"%J%\"]]" +} diff --git a/http/oauth2.http b/http/oauth2.http new file mode 100644 index 0000000..1e4b2a8 --- /dev/null +++ b/http/oauth2.http @@ -0,0 +1,40 @@ +# Read more at https://developers.interaapps.de/docs/accounts/oauth2 + +######## For the Account frontend + +### Get authorized OAuth2 Apps +# user.oauth.apps:read +GET https://accounts.interaapps.de/api/v2/authorization/oauth2/authorized_apps +Authorization: Bearer {{authkey}} + +### Get OAuth2 App +GET https://accounts.interaapps.de/api/v2/authorization/oauth2/apps/jc2l1yl7cg9t2im +Authorization: Bearer {{authkey}} + +### Granting OAauth2 app access to scopes +# user.oauth.apps:grant +GET https://accounts.interaapps.de/api/v2/authorization/oauth2/apps/jc2l1yl7cg9t2im/grant?scope=user +Authorization: Bearer {{authkey}} + +> {% client.global.set("oauth2_code", response.body.json.code); %} + + +######## For Apps + +### Receiving Access-Token +POST https://accounts.interaapps.de/api/v2/authorization/oauth2/access_token +Content-Type: application/json + +{ + "client_id": "{{oauth2_client_id}}", + "client_secret": "{{oauth2_client_secret}}", + "code": "{{oauth2_code}}" +} + +> {% client.global.set("oauth2_access_token", response.body.json.access_token); %} + +### Getting user information of granted OAuth2 App +GET https://accounts.interaapps.de/api/v2/user +Authorization: Bearer {{oauth2_access_token}} + + diff --git a/http/user.http b/http/user.http new file mode 100644 index 0000000..346261f --- /dev/null +++ b/http/user.http @@ -0,0 +1,37 @@ +### Get user information (https://developers.interaapps.de/docs/accounts/getting-user-information) +# Permission: user:read +GET https://accounts.interaapps.de/api/v2/user +Authorization: Bearer {{authkey}} + +### Set some user information (https://developers.interaapps.de/docs/accounts/writing-user-information) +# Permission: user:write +PUT https://accounts.interaapps.de/api/v2/user +Authorization: Bearer {{authkey}} +Content-Type: application/json + +{ + "description": "Loving chicken-wings! From api3" +} + +### Set some user information with custom content-types (https://developers.interaapps.de/docs/accounts/writing-user-information) +# Just set Accept (For response) or Content-Type (For Request contents) to application/json, application/x-yaml or application/x-www-form-urlencoded +PUT https://accounts.interaapps.de/api/v2/user +Authorization: Bearer {{authkey}} +Content-Type: application/x-yaml +Accept: application/x-www-form-urlencoded + +description: "Loving chicken-wings! From api3" + + +### Set profile picture +# user.profilepicture:edit +PUT https://accounts.interaapps.de/api/v2/user/profile_picture +Authorization: Bearer {{authkey}} +Content-Type: multipart/form-data; boundary=WebAppBoundary + +--WebAppBoundary +Content-Disposition: form-data; name="file"; filename="image.png" +Content-Type: image/png + +< ./example.png +--WebAppBoundary--