Clancey / simple_auth

The Simplest way to Authenticate in Flutter
MIT License
352 stars 108 forks source link

Uncaught Exception calling OauthApi.send() #118

Closed ChizuNoYama closed 4 years ago

ChizuNoYama commented 4 years ago

I try to make a request to get some user data and there is an uncaught exception, despite being surrounded by a try catch. The error I get is "Response (Instance of 'Response')" I'm not exactly sure what that means. it also seems like the access token i expired at that point. I haven't set up the refresh token because the server is managed by a different department. I tried putting break points in send, but it crashes event before reaching it. I can't find where this is being thrown

ChizuNoYama commented 4 years ago

I realized that the objects gets thrown if the request is not successful(if the auth server returns with a 401 or whatever). is this intended? Also, is there a way to clear where the auth data is stored after catching this?

ChizuNoYama commented 4 years ago

I just called the logout function. I'm guessing that clears any data holding access tokens and all that. I'll just close this.

Clancey commented 4 years ago

Yes, you should try/catch all authentication calls. They can fail from user clicking cancel, or from no internet. Or from it failing for any numerous web related issues. And yes Logout will clear it.

ChizuNoYama commented 4 years ago

@Clancey Thank you for clarifying!! Again, thanks for your hard work.