OpenID auth: what method to get a unique identifier to use as a key?

Using OpenID auth, which is the proper User method , to get a unique identifier useful for creating and identifying a user in a data store as key_name?

Available methods:

nickname () For OpenID users, an alias is an OpenID identifier.

federated_identity () Returns the OpenID user ID.

federated_provider () Returns the URL of the user's OpenID provider.

In user logins, I would like to get it:

User.get_by_key_name(key_used_to_create_the_user)
+3
source share
1 answer

You will probably want to create your own user ID on your system so that users can change their OpenID providers (or even have more than one OpenID associated with their account, which is supported by many sites). But if for some reason you want to use OpenID as a unique key, I think that federated_identity()is the one you want (just by reading the documents, I never used this library). You need a full OpenID URL that is guaranteed to be unique — this includes both the URL provider part and the username part (which can be a subfolder or subdomain, etc.). Sorry, I forgot the technical terms ... some time has passed since I used OpenID.

+2

Source: https://habr.com/ru/post/1760397/


All Articles