Details
-
Type: extRequest
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:None
-
Sender Email:
-
HD-Chapter:Security
-
HD-Enabler:KeyRock
Description
Hi,
I'm using an android library to get the access token using explicit
authentication.
API: https://github.com/wuman/android-oauth-client
This API is build on top of google API:
https://github.com/google/google-oauth-java-client
The authorization token is being retrieved correctly. The problem is when I
try to exchange it for an access_token.
Here is my request using the API:
AuthorizationFlow flow = new AuthorizationFlow.Builder(
//BearerToken.authorizationHeaderAccessMethod(),
//BearerToken.queryParameterAccessMethod(),
BearerToken.formEncodedBodyAccessMethod(),
OAuth.HTTP_TRANSPORT,
OAuth.JSON_FACTORY,
new GenericUrl(LoginConstants.TOKEN_SERVER_URL),
new BasicAuthentication(LoginConstants.CLIENT_ID,
LoginConstants.CLIENT_SECRET),
LoginConstants.CLIENT_ID,
LoginConstants.AUTHORIZATION_CODE_SERVER_URL)
.setScopes(Lists.<String> newArrayList())
.setCredentialStore(credentialStore)
.build();
DocString:
/**
- @param method method of presenting the access token to the resource
- server (for example
- {@link BearerToken#authorizationHeaderAccessMethod}
)
- @param transport HTTP transport
- @param jsonFactory JSON factory
- @param tokenServerUrl token server URL
- @param clientAuthentication client authentication or
{@code null}
for
- none (see
- {@link TokenRequest#setClientAuthentication(HttpExecuteInterceptor)}
- )
- @param clientId client identifier
- @param authorizationServerEncodedUrl authorization server encoded URL
*/
public Builder(AccessMethod method,
HttpTransport transport,
JsonFactory jsonFactory,
GenericUrl tokenServerUrl,
HttpExecuteInterceptor clientAuthentication,
String clientId,
String authorizationServerEncodedUrl)
I've been able to Intercept the Request and Response, and this is the
result:
Request:
*Request getUrl: *https://account.lab.fiware.org/oauth2/token
Request getRequestMethod: POST
Request getHeaders:
Request getContent:
code=QqU5dSHksT13hyb5yUMqZLGpge5S1f&grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%2FCallback&scope
Request getTransport:
com.google.api.client.http.javanet.NetHttpTransport@1182878e
Request getResponseHeaders:
Response:
*Response getStatusCode: *400
Response getStatusMessage: Bad Request
Response getHeaders:
Response getMediaType: application/json
Response getTransport:
com.google.api.client.http.javanet.NetHttpTransport@1182878e
Response getContentType: application/json
Response getContent:
IMPORTANT: I AM able to get the access token by using Chrome's REST client
with the
SAME Request getContent given above and the *SAME **Authorization: Basic
XXX* also given above, so they are correct.
I've tried to had Content-Type: application/x-www-form-urlencoded to the
request, but the error resulting was the same.
I AM able to use this API with another Identity Management Servers, like
foursquare.
Having no information on the error response and sending exactly what you
define in:
https://github.com/ging/fi-ware-idm/wiki/Using-the-FIWARE-LAB-instance
It Becomes hard to solve it from my side. I've tried giving you every
information I have, but If you require more, please ask.
–
[image: Inline image 1]
Pedro GonçalvesResearch Software EngineerPLUX - Wireless Biosignals, S.A.
Headquarters
*Zona Industrial das Corredouras, Lt. 14 - 1º2630-369 Arruda dos
VinhosPortugalT: +351 263 978 572*
Lisbon Office
Av. 5 de Outubro, 70 - 8º
1050-059 Lisboa
Portugal
T: +351 211 956 542
T: +351 211 956 546
F: +351 211 956 531
W: www.plux.info
_______________________________________________
Fiware-lab-help mailing list
Fiware-lab-help@lists.fi-ware.org
https://lists.fi-ware.org/listinfo/fiware-lab-help
[Created via e-mail received from: =?UTF-8?Q?Pedro_Gon=C3=A7alves?= <pgoncalves@plux.info>]
Activity
- All
- Comments
- History
- Activity
- Transitions