Please help Jmix team and community members to answer your questions:
- Jmix 2.2.1
- Basic demo app from examples
- Added rest api support
We are “”playing”” Jmix but we have some problems on oauth2 authentication …
Running a basic application our goal is to login and use some REST API like list some objects
from web and from mobile.
We can access to the rest api after login ( using JMIX application ) ed everithing is fine.
But how can we user REST API without JMIX Login ?
From web site we use JS and Fetch
We use Javascript
We use FetchApi as like this
// javascript fetch call to login
fetch(url, {
credentials : “include”,
method : “POST”,
mode : ‘cors’,
headers : {
“Content-Type” : “application/json”,
“Authorization” : 'Basic ’ + btoa(email + “:” + password),
‘Access-Control-Request-Method’ : ‘POST’,
},
// handle response
}).then(function(response) { …
How can we build a login ? using user and password ?
We dont want to use JMIX Vaadin GUI, because we develop a custom app web js/mobile android.
http://localhost:8080/oauth2/token ??
we are following your istructions :
Getting Started with REST :: Jmix Documentation (VER.2 )
curl --location ‘http://localhost:8080/oauth2/token’
–header ‘Content-Type: application/x-www-form-urlencoded’
–header ‘Authorization: Basic WkdKdFkyMXZhV2g21ZVRwaN2JtOXZjSDE0V1ZwU2NtdHZlRzFHOg==’
–data ‘grant_type=client_credentials’
Is there someting wrong ?
Is it possible to use Fetch to login and access the REST Api ?
Is there any example in JS or Android ?
thanks to all for the support
regards
Stefano