06-05-2017 04:31 - edited 06-05-2017 04:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-05-2017 04:31 - edited 06-05-2017 04:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
I'm using retrofit for getting Access token,Here is my android code,Error is added at top.Please check this.
String basic = "228K7X:1f92e3efa01658587abf868ddc6fd284";
String clientIdclientSecret = null;
//Get Refresh Token here
try {
clientIdclientSecret= Base64.encodeToString(basic.getBytes(), Base64.DEFAULT);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("clientIdclientSecret " + clientIdclientSecret);
AuthTokenRequest authTokenRequest = new AuthTokenRequest();
authTokenRequest.setCode(code);
authTokenRequest.setRedirect_uri("http://www.chronicwatch.com/");
authTokenRequest.setClientId("228K7X");
authTokenRequest.setGrant_type("authorization_code");
AuthApiInterface apiInterface = ApiClient.getClient().create(AuthApiInterface.class);
Log.i(TAG,"Auth ? "+"Basic "+clientIdclientSecret);
Log.i(TAG,"Content type ? "+"application/x-www-form-urlencoded");
Log.i(TAG,"authTokenRequest ? "+"authTokenRequest "+new Gson().toJson(authTokenRequest));
Call<AuthToken> authTokenCall = apiInterface.getToken("Basic "+clientIdclientSecret,"application/x-www-form-urlencoded",authTokenRequest);
Where getToken is
@POST("oauth2/token")
public Call<AuthToken> getToken(@Header("Authorization") String autho, @Header("Content-Type") String contentType, @Body AuthTokenRequest getAuthToken);
I'm getting Error like this:
java.lang.IllegalArgumentException: Unexpected char 0x0a at 58 in Authorization value: Basic MjI4SzdYOjFmOTJlM2VmYTAxNjU4NTg3YWJmODY4ZGRjNmZkMjg0
Answered! Go to the Best Answer.

Accepted Solutions
06-05-2017 22:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-05-2017 22:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@Gondwana , Thanks for your reply

06-05-2017 05:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-05-2017 05:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This Issue is Fixed By doing
String auth_header = ("Basic "+clientIdclientSecret).toString().trim();

06-05-2017 13:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-05-2017 13:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Glad you fixed it, but just in case...
0x0A is a line-feed character, which is placed at the end of text lines (sometimes with CR 0x0D) in some operating systems. If you're seeing spurious 0x0A, it could be because something is configured for the wrong operating system. An example of when this can happen is when files are copied using ftp (or equivalent), and the relevant end-of-line conversion isn't done correctly.
Gondwana Software
06-05-2017 22:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-05-2017 22:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@Gondwana , Thanks for your reply

