User API \ Import a user by using an access token PHP SDK

Users /users.json List all
Import from access token
User /users/<user_token>.json Retrieve user details Delete
User /users/<user_token>/contacts.json Read user contacts
User /users/<user_token>/publish.json Publish on social networks


Request: the code to send to the API

Send a PUT request with the data below to the resource /users.json to import a user by using an access token received from a social network.

This endpoint should be used when you rely on a native social network SDK for the login on a mobile device. Upon successful authentication with the native SDK you can import the user to OneAll and retrieve his details by sending his access token to this endpoint. The endpoint can be used without authentication so that you can use it in a mobile application without having to store the public/private keys of your OneAll site.

PUT data to include in the request

		"request": {
			"user": {
				"action": "import_from_access_token",
				"user_token": "#user_token#",
				"identity": {
					"source": {
						"key": "#provider_key#",
						"access_token": {
							"key": "#access_token_key#",
							"secret": "#access_token_secret#"
Key Description
#user_token# An optional user_token to link the imported social network profile to.
Example: 24f6eaef-7537-45b3-bf4c-0c2a772bdee4
* #provider_key# The key of the social network from which the access token originates.
Example: facebook
* #access_token_key# The user's access token as received from the social network .
Example: CAABwiWr8tH8BAGKCYOIgoMwJ9T0ZAmJ6KJJNcUjzmftdAOC [...]
#access_token_secret# The user's access token secret (Provided by only a few social networks).
Example: T0OzJdwrUy3arA8kqZTTkYDkLPI3WRppmJ6KJJNcUjzmftdAOC [...]

Result: the code returned by the API

If the user could successfully be imported, the API will return the details of the user including an identity. The identity is a data representation of the social network profile data. Depending on the social network, more or less information is available.

The API may return one of the following HTTP status codes:

  • 201: There was no user for this access token, a new user has been created.
  • 200: There was already a user for this acces token, the exisiting user has been updated.
  • ???: In any other case an error has occured

Example for an existing user with a Facebook identity:

		"response": {
			"request": {
				"date": "Tue, 13 Sep 2014 11:24:28 +0200",
				"resource": "/users.json",
				"status": {
					"flag": "success",
					"code": 200
						"user_token": "2cec711d-ca14-4472-98c8-ca74432bc2d3",
						"date_creation": "Tue, 1 Sep 2011 11:01:12 +0200",
						"date_last_login": "Tue, 13 Sep 2014 11:24:28 +0200",
						"num_logins": "64",
						"identities": [
								"identity_token": "3ab5257b-ba2b-4242-a7f6-950b4c47938f",
								"provider": "facebook",
								"id": "",
								"displayName": "John Doe",
									"formatted": "John John"
									"givenName": "John",
									"familyName": "Doe"
								"gender": "male",
								"birthday": "01/01/1980",
								"utcOffset": "2:00",
										"value": "",
										"is_verified": "true"

User Contributed Notes