Skip to content

Commit

Permalink
Added .http files
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianFun123 committed Jun 4, 2021
1 parent 3c33927 commit eda0a56
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
target
*.iml
*.env
http-client.private.env.json
13 changes: 13 additions & 0 deletions http/README.md
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions http/authentication.http
Original file line number Diff line number Diff line change
@@ -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}}
11 changes: 11 additions & 0 deletions http/authkey.http
Original file line number Diff line number Diff line change
@@ -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}}
37 changes: 37 additions & 0 deletions http/contacts.http
Original file line number Diff line number Diff line change
@@ -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"
}
10 changes: 10 additions & 0 deletions http/developer_center.http
Original file line number Diff line number Diff line change
@@ -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}}

Binary file added http/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions http/http-client.private.env.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"dev": {
"authkey": "",
"oauth2_client_id": "",
"oauth2_client_secret": "",
"oauth2_code": "",
"iaauth_key": "",
"iaauth_userkey": "",
"iaauth_friend": "",
"name": "",
"password": "",
"email": ""
}
}
47 changes: 47 additions & 0 deletions http/iaauth.http
Original file line number Diff line number Diff line change
@@ -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%\"]]"
}
40 changes: 40 additions & 0 deletions http/oauth2.http
Original file line number Diff line number Diff line change
@@ -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}}


37 changes: 37 additions & 0 deletions http/user.http
Original file line number Diff line number Diff line change
@@ -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--

0 comments on commit eda0a56

Please sign in to comment.