Android Question ResponseError. Reason: Unauthorized, Response: {"Msg:"Authorization has been denied for this request

Calvin Yee

Member
Licensed User
I have an HttpJob where I'm trying to set the header in the following way.
While requesting any data from API, the request should include Authorization header with Bearer as its scheme then follow by authentication token.

JobNDLogin.Initialize("JobNDLogin", Me)
JobNDLogin.Download2("https://test.b2b.com.my/api/cust/Login", Array As String("username", strLoginID, "password", strLoginPassword))
JobNDLogin.GetRequest.SetHeader("Authorization : Bearer " , access_token )

I obtain the following error.
ResponseError. Reason: Unauthorized, Response: {"Msg:"Authorization has been denied for this request

Any suggestion to fix this problem?
Thanks a Lot to everyone.
Best regards.
 

aeric

Expert
Licensed User
Longtime User
Have you tried:
B4X:
JobNDLogin.Username = strLoginID
JobNDLogin.Password = strLoginPassword
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You Authorization Header is wrong:

Try it this way
B4X:
JobNDLogin.GetRequest.SetHeader("Authorization","Bearer "&access_token )
 
Last edited:
Upvote 0
Top