auth0 / Guardian.Android

Android toolkit for Auth0 Guardian API
https://auth0.com/guardian
MIT License
5 stars 18 forks source link

Enrollment fails #81

Closed AndrewStratigos closed 5 years ago

AndrewStratigos commented 5 years ago

Enrolling (/api/enroll) fails in the Guardian sdk.

I get response: HTTP Response: 401 (Unauthorised) Message: Missing Authentication

File: Guardian.Android/guardian/src/main/java/com/auth0/android/guardian/sdk/GuardianAPIClient.java Method: public GuardianAPIRequest<Map<String, Object>> enroll

Steps to reproduce: Clone repo, set google api value, set auth0 base url, Gradle Sync, Build, Deploy, Scan a Barcode. {{ Error is displayed }}

lbalmaceda commented 5 years ago

@AndrewStratigos I just tried this:

Please check the logs on the dashboard and see if you can provide more information. Otherwise, don't hesitate contacting support if this persists.

ghost commented 5 years ago

Hi @lbalmaceda,

I've the same problem when I'm trying to unenroll

D/OkHttp: --> DELETE https://####.guardian.eu.auth0.com/api/device-accounts/####
    Authorization: Bearer ###
    Accept-Language: en_GB
    User-Agent: GuardianSDK/0.4.0(1) Android 8.0.0
    Auth0-Client: #####
    --> END DELETE
D/OkHttp: <-- 401 https://######.guardian.eu.auth0.com/api/device-accounts/#####(530ms)
D/OkHttp: date: Tue, 23 Jul 2019 22:39:08 GMT
    content-type: application/json; charset=utf-8
    content-length: 104
    set-cookie: #######
    server: nginx
    www-authenticate: Bearer
    cache-control: no-cache
D/OkHttp: {"statusCode":401,"error":"Unauthorized","message":"Missing authentication","errorCode":"invalid_token"}
    <-- END HTTP (104-byte body)

I don't have any entry logs on the Auth0 dashboard

lbalmaceda commented 5 years ago

@mario-moura-silva is 0.3.0 still working for you? If so, keep using that one. Your project might still be using the old GCM libraries or project setup. The 0.4.0 release was meant to update this SDK to support the migration to the new Firebase Cloud Messaging platform. I'm pretty sure this is a configuration issue on your project or the google console project. As I explained, nothing has changed besides that compatibility. Try asking in our community here https://support.auth0.com/.

ghost commented 5 years ago

@lbalmaceda,

Yes. We're using the 0.3.0 in production with GCM. Now, we're migrating to the new FCM.

We're getting this unauthorized error from Auth0 side invoking the endpoint https://< tenant >.guardian.eu.auth0.com/api/device-accounts/< device_id >

Looking to the Auth0 dashboard logs, I don't see any entry related with this call. I don't think this is related to the configuration on Google project.

With some Android version, I got the same error on clicking in Allow button (api/resolve-transaction):

Android version: 9
Kernel version: 4.4.111-16290088
Knox version: 3.2.1
Knox API level: 27
lbalmaceda commented 5 years ago

I've reported this to the Guardian team. Let's see if they have another response 👍

santiagoaguiar commented 5 years ago

@mario-moura-silva thanks for reporting this. The issue for DELETE was addressed, can you please try this again?

The issue was introduced to the Europe region three days ago, and only affected DELETE calls from Guardian Apps. The token comparison was not working correctly and was rejecting valid tokens.

lbalmaceda commented 5 years ago

I'll proceed to close this. If you find another issue, please reach https://support.auth0.com/