vimeo / vimeo-networking-java

The Vimeo Java (Android) SDK
MIT License
121 stars 49 forks source link

Vimeo sdk is not working on android #613

Open nitish1227 opened 1 year ago

nitish1227 commented 1 year ago

Summary

Vimeo sdk is not working on android. I am using github code in android. but log-in functionality is not working in demo.

Reproduction Steps

authenticate method not working. I have added client and secret key and I have added CODE_GRANT_REDIRECT_URL I am using CODE_GRANT_REDIRECT_URL: vimeoa98a01c93be150d26c2739b713429580bc0d47f2://auth. and I have added in manifeast

            <data android:host="auth"/>

private fun authenticate(redirectUri: Uri?, authenticator: Authenticator) { if (redirectUri != null) { // Optional, but for security purposes, we can verify that the code we specified is returned to us. val requestCode = redirectUri.getQueryParameter("state") require(requestCode == REQUEST_CODE)

        // Log in using the code grant URI provided to us by the redirect.
        authenticator.authenticateWithCodeGrant(redirectUri.toString(), vimeoCallback(
            onSuccess = {
                toast("Successfully logged in.")
                binding.loginStatus.text = authenticator.currentAccount.asLoginStatus()
            },
            onError = { toast("Unable to log in.") }
        ))
    } else {
        // Obtain client credentials which can be used to make logged out requests.
        // Obtaining client credentials is technically optional and basic auth can be used instead. However, using
        // basic auth can result in your client secret being leaked, so it is better to use client credentials. If
        // client credentials are not obtained or this request fails, the VimeoApiClient will fall back to basic
        // authentication.
        authenticator.authenticateWithClientCredentials(vimeoCallback(
            onSuccess = {
                toast("Obtained client credentials.")
                binding.loginStatus.text = authenticator.currentAccount.asLoginStatus()
            },
            onError = { toast("Couldn't obtain client credentials.") }
        ))
    }
}

Expected Behavior

I have received error: Api(reason=ApiError(developerMessage=Code grant authentication error, errorMessage=null, errorCode=null, invalidParameters=[InvalidParameter(field=code, errorCode=2204, error=null, developerMessage=URI was invalid or did not contain a 'code' parameter)], link=null), httpStatusCode=-1)

Actual Behavior

What currently happens as a result of the reproduction steps?