I have been able to install SSL successfully. However, I can't seem to get the token still.
**First request**
GET
https://gluu-srv.example.com/oxauth/seam/resource/restv1/oxauth/authorize?scope=profile&response_type=code&client_id=@!B190.F04D.5DCA.D6B3!0001!CC4E.B109!0008!425D.A5A0&redirect_uri=https://demo.dev/oauth-login.php
Without using a libray, but just using using JavaScript, in `oauth-login.php`, this is the code:
'use strict';
var token = $("#token");
fetch('https://gluu-srv.example.com/oxauth/seam/resource/restv1/oxauth/token',{
method: 'post',
headers: {
'Content-Type':'application/x-www-form-urlencoded'
},
mode: 'cors',
body: {
code: '<?php echo $_GET["code"]; ?>',
client_id: "<?php echo CLIENT_ID ?>",
client_secret: "<?php echo CLIENT_SECRET ?>",
redirect_uri: '<?php echo SITE ?>/data.php',
grant_type: "authorization_code",
}
}).then(function(response) {
console.log(response);
return response.json();
}).then(function(json_response) {
var html = '<div class="alert alert-danger">';
html += '<h3>Status: ' + json_response.error + '</h3>';
html += '<p>' + json_response.error_description + '</p>';
html += '</div>';
token.html(html);
console.log(json_response);
}).catch(function(response) {
console.log(response);
});
**Second request** (can be translated as follows)
POST
HOST: https://demo.dev
Content-Type: application/x-www-form-urlencoded
code={code}&client_id={client_id}&client_secret={client_secret}&redirect_uri=https://demo.dev/data.php&grant_type=authorization_code
I checked my settings:
dn: inum=@!B190.F04D.5DCA.D6B3!0001!CC4E.B109!0008!425D.A5A0,ou=clients,o=@!B190
.F04D.5DCA.D6B3!0001!CC4E.B109,o=gluu
objectClass: oxAuthClient
objectClass: top
oxAuthScope: inum=@!B190.F04D.5DCA.D6B3!0001!CC4E.B109!0009!10B2,ou=scopes,o=@!B
190.F04D.5DCA.D6B3!0001!CC4E.B109,o=gluu
oxAuthScope: inum=@!B190.F04D.5DCA.D6B3!0001!CC4E.B109!0009!43F1,ou=scopes,o=@!B
190.F04D.5DCA.D6B3!0001!CC4E.B109,o=gluu
oxAuthRequestURI: https://demo.dev/data.php
oxAuthGrantType: authorization_code
oxPersistClientAuthorizations: false
oxAuthPolicyURI: https://demo.dev/policy
oxAuthLogoutURI: https://demo.dev/logout.php
oxAuthLogoutURI: https://demo.dev/sign-out.php
oxAuthResponseType: code
oxAuthLogoutSessionRequired: true
oxAuthAppType: web
oxAuthTrustedClient: true
oxAuthTosURI: http://demo.dev/terms
oxAuthClientSecret: 1SdyFn8TdsEdegfeyVAE1r/Y463q5v8GcnKWpqXuuRyMPPtYzZXjrQ==
oxAuthSubjectType: public
oxAuthClientURI: http://demo.dev
oxAuthIdTokenSignedResponseAlg: HS256
oxLastAccessTime: 20161004165146.891Z
oxAuthTokenEndpointAuthMethod: client_secret_post
oxAuthRedirectURI: https://demo.dev/oauth-login.php
displayName: Song App
inum: @!B190.F04D.5DCA.D6B3!0001!CC4E.B109!0008!425D.A5A0
Still, I get `401 invalid client` error.
This is the error I'm getting in the first console.log:
Response { type: "cors", url: "https://gluu-srv.example.com/o…", status: 401, ok: false, statusText: "Unauthorized", headers: Headers, bodyUsed: false } oauth-login.php:91:17
Error in the second console.log:
Object { error: "invalid_client", error_description: "Client authentication failed (e.g. …" }
Is there any other settings that I need to change? Why am I getting `invalid_client` error