box / box-android-sdk

Apache License 2.0
62 stars 68 forks source link

Again: "Authentication Failed, Contact admin to authorize this device" #423

Closed mdicosimo closed 4 years ago

mdicosimo commented 4 years ago

It seems that it was asked before but I don't understand how to solve. After clicking the "Grant access to Box" button, I receive the message: "Authentication failed, Contact your administrator to authorize this device". This is from Logcat:

sample I/BoxContentSdk: Request (POST): https://api.box.com/oauth2/token 2020-04-05 23:23:43.306 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Header: User-Agent:com.box.sdk.android/5.0.0 2020-04-05 23:23:43.306 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Header: Accept-Encoding:gzip 2020-04-05 23:23:43.307 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Header: Accept-Charset:utf-8 2020-04-05 23:23:43.307 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Header: Content-Type:application/x-www-form-urlencoded 2020-04-05 23:23:43.307 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Form Data: code: 2020-04-05 23:23:43.308 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Form Data: grant_type:authorization_code 2020-04-05 23:23:43.309 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Form Data: client_secret: 2020-04-05 23:23:43.309 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Request Form Data: client_id: 2020-04-05 23:23:43.310 18734-18874/com.box.androidsdk.sample I/BoxContentSdk: Response (400): {"error":"unauthorized_client","error_description":"The grant type is unauthorized for this client_id"} 2020-04-05 23:23:43.313 18734-18873/com.box.androidsdk.sample W/System.err: java.util.concurrent.ExecutionException: com.box.androidsdk.content.BoxException: An error occurred while sending the request

The Authentication Metod that I selected in the Box Console is "OAuth 2.0 with JWT (Server Authentication)"

Client ID and Client Secret are defined in the "OAuth 2.0 Credentials" section. What else am I overlooking?

Thank you, Max

PJSimon commented 4 years ago

Hi @mdicosimo

Sorry for the delay on getting back to you. Given the time since you reported it (again, sorry about the delay), let me start by checking if you are still having the issue or if you solved it. If you solved it, we'd love to hear what the root cause was and how you fixed it. Thanks!

mdicosimo commented 4 years ago

Hello PJSimon, no, I was not able to solve it. For the moment I gave up on Box.

sujaygarlanka commented 4 years ago

Hello @mdicosimo, Our Android SDK does not support JWT authentication. It currently only supports OAuth. It should work once you change the authentication method for your app and add a redirect URL to the app. For any questions regarding using Box APIs, other good resources aside from posting on Github are our recently updated developer docs and our box community forum. Hope this helps and sorry for the delay!