You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/09/22 17:52:48 UTC
[fineract] branch develop updated: Change OAuth doc in apiLive.htm
(FINERACT-629)
This is an automated email from the ASF dual-hosted git repository.
vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new f73f5ef Change OAuth doc in apiLive.htm (FINERACT-629)
f73f5ef is described below
commit f73f5ef50f48b39b810577c2155290078387dc13
Author: Michael Vorburger <mi...@vorburger.ch>
AuthorDate: Fri Sep 11 00:08:51 2020 +0200
Change OAuth doc in apiLive.htm (FINERACT-629)
---
.../src/main/resources/static/api-docs/apiLive.htm | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/fineract-provider/src/main/resources/static/api-docs/apiLive.htm b/fineract-provider/src/main/resources/static/api-docs/apiLive.htm
index 129b099..d08103f 100644
--- a/fineract-provider/src/main/resources/static/api-docs/apiLive.htm
+++ b/fineract-provider/src/main/resources/static/api-docs/apiLive.htm
@@ -4402,22 +4402,28 @@ function executeAjaxRequest(url, verbType, jsonData, basicAuthKey, successFuncti
</div>
<div class="method-example">
<code>
-// A Javascript/Jquery example of how to login to Apache Fineract and use its api.
-// Typically, the javascript application would
+// A Javascript/JQuery example of how to login to Apache Fineract and use its API.
+// Typically, the JavaScript application would:
// 1) Display a login page to retrieve the username and password.
// 2) Send the username, password, client_id , grant_type and client_secret to a function
-// such as getOauthToken below which sets the HTTP bearer Auth key.
+// such as getOauthToken() below which POSTs these as x-www-form-urlencoded (but NOT in the URL, see FINERACT-629)
+// and stores the token in a global variable.
// 3) The HTTP bearer Auth key is used in all subsequent requests
-// (see the function executeAjaxRequest below).
+// (see the function executeAjaxRequest() below).
function getOauthToken(username, password) {
var jqxhr = $.ajax({
- url : "/fineract-provider/api/oauth/token?username=" + credentials.username + "&password=" + credentials.password +"&client_id=community-app&grant_type=password&client_secret=123,
+ url : "/fineract-provider/api/oauth/token",
type : 'POST',
- contentType : "application/json; charset=utf-8",
dataType : 'json',
- data : "{}",
+ data : {
+ username: credentials.username,
+ password: credentials.password,
+ client_id: "community-app",
+ grant_type: "password",
+ client_secret: "123"
+ },
cache : false,
success : function(data, textStatus, jqXHR) {
authKey = data.access_token;