Get Login Options

Curl request

$ curl 'https://logbook.stainhaufen.de/api/user/login-options' -i -X GET

HTTP response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 165

{
  "failed" : false,
  "oauthProviders" : [ {
    "name" : "Local",
    "url" : "/oauth2/authorization/local",
    "id" : "local",
    "icon" : null
  } ]
}

Response body

{
  "failed" : false,
  "oauthProviders" : [ {
    "name" : "Local",
    "url" : "/oauth2/authorization/local",
    "id" : "local",
    "icon" : null
  } ]
}

Response fields

Path Type Description

failed

Boolean

Set to true, when authentication failed

oauthProviders

Array

List of possible login providers

oauthProviders[].name

String

Name of provider

oauthProviders[].url

String

Url for provider

oauthProviders[].id

String

Id of provider

oauthProviders[].icon

String

Icon for provider

Endpoint for unauthorized Users

Same as Get Login Option, but with Http-Status 401

Curl request

$ curl 'https://logbook.stainhaufen.de/api/user/unauthorized' -i -X GET

HTTP response

HTTP/1.1 401 Unauthorized
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 165

{
  "failed" : false,
  "oauthProviders" : [ {
    "name" : "Local",
    "url" : "/oauth2/authorization/local",
    "id" : "local",
    "icon" : null
  } ]
}

Response body

{
  "failed" : false,
  "oauthProviders" : [ {
    "name" : "Local",
    "url" : "/oauth2/authorization/local",
    "id" : "local",
    "icon" : null
  } ]
}

Response fields

Path Type Description

failed

Boolean

Set to true, when authentication failed

oauthProviders

Array

List of possible login providers

oauthProviders[].name

String

Name of provider

oauthProviders[].url

String

Url for provider

oauthProviders[].id

String

Id of provider

oauthProviders[].icon

String

Icon for provider

Get User info

Curl request

$ curl 'https://logbook.stainhaufen.de/api/user/info' -i -X GET

HTTP response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 262

{
  "id" : "b07620cc-c258-4e12-8ce7-7b77d992f35f",
  "providers" : [ {
    "provider" : "local",
    "profileUri" : "local/profile/id"
  } ],
  "email" : "test@test.test",
  "nickname" : "test",
  "name" : "Test Test",
  "pictureUri" : "picture/test"
}

Response body

{
  "id" : "b07620cc-c258-4e12-8ce7-7b77d992f35f",
  "providers" : [ {
    "provider" : "local",
    "profileUri" : "local/profile/id"
  } ],
  "email" : "test@test.test",
  "nickname" : "test",
  "name" : "Test Test",
  "pictureUri" : "picture/test"
}

Response fields

Path Type Description

id

UUID

Internal id of user

email

String

Email of user

nickname

String

Nickname of user

name

String

Full Name of user

pictureUri

String

Uri of picture to use

providers[]

Array

Array of providers where user is authenticated

providers[].provider

String

Id of the provider

providers[].profileUri

String

Uri of the user for provider

Login

Curl request

$ curl 'http://localhost:8080/oauth2/authorization/local?redirect=/user/info' -i -X GET

HTTP response

HTTP/1.1 302 Found
Location: https://url/to/provider

Get Parameter

Table 1. /oauth2/authorization/{providerId}?redirect={redirect target}
Parameter Type Description

providerId

String

Provider to log in

redirect

String

Target to goto in case of login success