Can I get device id (android device id for example) at login in a rule ? How?

Can I get device id (android device id for example) at login in a rule ? How ?

I’d need this to persist it in my application layer session management.

Hi,
Do you have that id stored in your profile already?

The device id isn’t transferred automatically, but you can pass it along in the authorization request.
I guess you’re using a regular OAuth2 redirect flow, or the standard way we recommend via AndroidSDK?

If you look for extraParams in this forum, you find a way, though this extraParams isn’t part of the OAuth2 specs.

While it (still) works, I would rather recommend this:

Pass an upstream_params parameter in the authorization request. I don’t know the details of the Android SDK so I show you the way in our JS SDK, but it’s the same approach in Android then accordingly.

this.$auth.loginWithRedirect({"upstream_params":"myDeviceId"});

In the Rule, you can then get it via:

context.request.query.upstream_params

Hi, no I don’t. It should come on the login process somehow.

This is actually the kind of thing I’m looking for. I would just need to validate if this can be done from the Android SDK.

Thanks !!

I haven’t used the Android SDK myself, but maybe it’s this one (not tested)? https://auth0.com/docs/libraries/auth0-android/configuration#withparameters

If you find out, please post it here.