Auth0 Home Blog Docs

Getting App meta data in android using lock

I get a Management Exception whenever I try to get the app metadata from the user profile, despite successful login.

private fun getProfile(accessToken: String) {
            .start(object : BaseCallback<UserProfile, AuthenticationException> {
                override fun onSuccess(userinfo: UserProfile) {
                        .start(object : BaseCallback<UserProfile, ManagementException> {
                            override fun onSuccess(profile: UserProfile) {
                                val orgID = profile.appMetadata["OrgID"] as String
                                val orgName = profile.appMetadata["OrgName"] as String
                                val orgType = profile.appMetadata["OrgType"] as String
                                App.prefs.orgID = orgID
                                App.prefs.orgName = orgName
                                App.prefs.orgType = orgType

                            override fun onFailure(error: ManagementException) {
                                // Show error
                                Log.e("PostLogin","management error")


                override fun onFailure(error: AuthenticationException) {
                    // Show error

Error is as follows An error occurred when trying to authenticate with the server.

–my code is in kotlin put if you point me to a java solution, that’s fine too. Thanks

Hi @koguno,

Can you look in the auth0 dashboard logs and see why the authentication if failing?