Web-Login
You can use the API to receive a token which can be used to log-in the user into the web-application, using their api-token. If you provide a URL, the user will be forwarded to this location, after a successful login.
Do not forget to use HTTPS for your call, or simply use the URL provided! Replace [webgate_url] with the URL you want to be redirected to after login. Optionally you can switch webgate into a (smaller) iframe-view.
There are two calls:
- To the API, receiving a temporary login-token. It is valid 2 minutes.
- To the web-application, containing the token and optional a url, the color and iframe-view.
For your convenience you can use the provided URL and just replace/add what you need. Especially the "login_for_url" which will redirect the user to, after a successful login.
Actions | |||
---|---|---|---|
Create | POST (may change to GET) | /api/web_login | - |
Create | GET | /login_with_token?token=:token_hash?login_for_url=[webgate_url][%26fix_color=(white|black)][%26iframe=1] | - |
Example
Finding a token
Request:
POST /api/web_login HTTP/1.1 Authorization: Bearer example-token Content-Type: application/json
Response:
HTTP/1.1 200 Ok {"status":200,"status_message":"OK", "info":"Do not forget to user HTTPS for your call, or use the URL provided! Replace [webgate_url] with the URL you want to be redirected to after login. Optionally you can switch webgate into a (smaller) iframe-view.", "data":{"hash":{"token":"74f551c0909f3a4b187361f7a75c6e97b6695f2c", "web_login_url":"https://webgate.de/login_with_token?token=74f551c0909f3a4b187361f7a75c6e97b6695f2c&login_for_url=[webgate_url][&fix_color=black%26iframe=1]"}}}
Example
Logging in and forwarding to url
Request:
GET https://webgate.de/login_with_token?token=cfd3af589d729fb7c19ac59637bb5bf8e4f59ebf&login_for_url=https://webgate.de/playlists/1?fix_color=black%26iframe=1