box / box-android-sdk

Apache License 2.0
62 stars 68 forks source link

Box content sdk authentication failed error #183

Closed ashishparmar closed 8 years ago

ashishparmar commented 8 years ago

I have used box content sdk for integration in my application .I entered email address and password correctly and I got logged in successfully and sdk display grand access page to allow me to grand access but when I click on grand access button I got authentication failed error every time.

I got following error with protocol number :

TYPE_WEB_ERROR﹕ Authentication Failed Details: -10 The protocol isn't supported. Kindly help me if anyone has an idea on this.

Thank you in advanced!!

doncung commented 8 years ago

Where are you seeing that error? Is it from logcat? If so can you post the original stacktrace?

ashishparmar commented 8 years ago

I can access login screen easily :+1:

login_screen

After login screen i got below screen: grand_access - copy

on grand access button i got the failed authentication error as i post the error code

doncung commented 8 years ago

I see thanks. I think the error is happening inside the webview for some reason possibly device or network specific. Can you try cloning the repo and adding some logging or breakpoint to the onReceivedError logic in the OauthWebView? What I'm looking for is the "failingUrl" for that error code and description.

ashishparmar commented 8 years ago

I am surprised to suddenly break down this SDK for android , even it is work in iOS , So what is the problem ,can you please suggest the new SDK version or can you reference new working demo?

Yes, you are right I got only "failing URL". During the logging.

I got this URL from debugging and place to a normal browser where I can logging easily but when I going to grand access same response got here blank page also that I mention above comment with the picture that I uploaded. can you please explain more about this issue?

Thnks in advance.

doncung commented 8 years ago

Which branch/ version are you using? You can try the baymax branch which we are using in our official application, but very little of the auth logic has changed. Protocol isn't supported would indicate somehow there is a weird redirect to an unrecognized authority. Speaking of which, what is the redirect url you are using?

ashishparmar commented 8 years ago

I am using master branch but today I have noticed that "Updated 2 days ago by doncung" . So , is this updated master branch completed version?

And I am using "boxsdk-://boxsdkoauth2redirect" redirect_url like in iOS use. can you please explain if I am not going to use "Redirect Url" than what's the problem will occur?

doncung commented 8 years ago

I see that is probably the reason. Android's webview doesn't recognize the boxsdk-:// authority so it is treating that as an error. Please try using https:// as the authority.
You can also potentially override shouldOverrideUrlLoading to intercept the custom authority before it gets to the error logic, but I would recommend the former.

ashishparmar commented 8 years ago

Thank you for the answer . But Can you please explain what shout be right for generate " https:// " as redirect URL. Some example ? My question is that what should be there?

doncung commented 8 years ago

We suggest the default: https://app.box.com/static/sync_redirect.html If you have your own server page you can also use that, but the user will only be navigated there very briefly.

doncung commented 8 years ago

Closing this as it should be resolved, please create a new issue if there are issues after changing the redirect.

paragchandra commented 8 years ago

I'm seeing the same issue, on the "baymax" branch. What am I supposed to use for the redirect URL? I have tried the default you suggested, literally "https://app.box.com/static/sync_redirect.html". That does not work - I get a "There seems to be a problem with this app" error page. Likewise, I have tried changing the "boxsdk-xxxx://" portion to "https-xxxx://", but no dice.