question

Mateus avatar image
Mateus asked Mark Mullan Deactivated answered

Calling CloverAuth.authenticate(context, account) ignoring the result makes sense?

I'm working on an android project originally coded by someone else. For a few screens, I can see calls to CloverAuth.authenticate(context, account) that completely ignore the AuthResult returned.

My first impression is that such code does nothing and these calls can be removed. On the other side, I'm not sure if the authenticate method does anything else other than fetching a token(which could make the code have some purpose).

So that's my question: can a call to CloverAuth.authenticate(context, account) ignoring the result have any impact at all?

OAuth
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Mark Mullan avatar image
Mark Mullan Deactivated answered

Hi @mateus,

Thanks for getting in touch and for asking. You're right, CloverAuth.authenticate(context, account) is used for its AuthResult that's returned, to grant you an OAuth token in case you need to make plain old REST calls instead of using the wrappers that our SDK provides. It doesn't "do" anything other than that, so those calls can and should be removed.

This is the only caveat - https://docs.clover.com/announcements.... Calling CloverAuth.authenticate() for the first time might just be a way to make a request to our server to fetch the token, so that a second authenticate() call can take advantage of on-device caching. But if you're never doing anything with the AuthResult, then the 1st paragraph is more applicable.

Hope that helps,

Mark

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community