Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic docs about actually using the SDK after logging in #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

langsmith
Copy link
Contributor

@langsmith langsmith commented Oct 18, 2024

This pr adds very basic docs about actually using the SDK after logging in.
I'm surprised that this type of info doesn't already exist on https://docs.frontegg.com/docs/android-kotlin 😕 All of the current sections in https://docs.frontegg.com/docs/android-kotlin are about how to set up the SDK, how to log in, and how to log out.

However, there's no advice on how to actually use the SDK on a day-to-day basis as an Android developer trying to get started with the SDK and implementing it throughout an Android project.

Without lots of exploration and dumb luck, there's no way I would've quickly known how to get the user's name, email, etc. Android developers implementing the SDK should quickly and easily know that this information 👇🏽 exists in the SDK:
Screenshot 2024-10-18 at 12 38 05 PM

If the Frontegg team isn't happy with these docs, then I'd request that they provide edits and/or add their own similar docs.

@langsmith langsmith changed the title Adding basic docs about actually using Android SDK after logging in Add basic docs about actually using the SDK after logging in Oct 18, 2024
@simbelmine
Copy link

Adding some notes from my experience so far:

  • Authentication
    One can listen for the authentication events by
    private val onAuthenticatedChanged: Consumer<NullableObject<Boolean>> = Consumer { isAuthenticated ->
        onAuthenticationChanged(isAuthenticated.value)
    }
  • Access Token
    One can get it from FronteggAuth.instance.credentialManager.get(CredentialKeys.ACCESS_TOKEN).
    But it's better to listen for the Access Token through the callback after isAuthenticated == true in onAuthenticatedChanged callback. This way it will always be up to date.
    Not sure if the difference is huge.
    FronteggAuth.kt contains all the logic. It was one of the places I needed to go to regurly.
private val onAccessTokenChanged: Consumer<NullableObject<String?>> = Consumer { accessToken ->
        // Update the Local Token, or do something else.
    }
  • User data
    One can access it directly with FronteggAuth.instance.user, or through to listen to the Observable. Again not clear what is better. I don't think the user changes on the flight 🤔
  • Log Out
    It turned out that the LogOut also has a callback that is triggered when the event is Done.
    I struggled to figure out how to load the Hosted Login page again after log out.
    Here the solution:
FronteggAuth.instance.logout {
     FronteggAuth.instance.login(activity) 
}

DESIGN
The following is more custom so not the place in the README but worth mentioning.
If one needs to change the design of the Hosted Login needs to host a server and change the design there.
In my case that was not really feasible so I figured that one can access the HostedActivity and work with it to do some changes. It's limited but it's something.

Screenshot 2024-10-18 at 2 14 42 PM

image

PROGUARD
I think it was mentioned in somewhere else that the Documentation lacks mentioning that we need to add Proguard Rules if we use Gradle 8+ since ProGuard becomes the more strict version called R8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants