Donate using PayPal

CycleStreets API (v2)

  • Details for:
  • API overview
  • Obtain API key
  • Usage policy
  • Uptime policy

User authenticate

This API call validates user credentials.

Users can use either their username or e-mail address as the identity to validate against.

Certain parts of the CycleStreets API, such as addition of a photo, require correct user credentials to be supplied with those calls, and so they implement the same checks as this API call. This is a standalone method, that can be useful if the client UI has a specific screen for logging in a user.

Note that the validation status of the account will be checked (i.e. that the user has clicked on the link they were sent when creating the account, which confirms the validity of their e-mail address).

Security: As with the rest of the API, this method requires use of HTTPS.

(OpenID-based user authentication is not available or implemented at this time.)

Example

Example which authenticates the user.

POST https://api.cyclestreets.net/v2/user.authenticate

(
	[identifier] => myusername
	[password] => mypassword1978
)

or

(
	[identifier] => user@example.com
	[password] => mypassword1978
)

Result:

{
    "name": "Sam Smith",
    "email": "user@example.com",
    "username": "myusername",
    "privileges": [
    ]
}

Request parameters - required

This call requires a POST operation, to avoid us logging user credentials in the server logs.

identifier string
A valid CycleStreets account username or e-mail address. (See the user.create API call.) The validation status of the account will be checked (i.e. that the user has clicked on the link they were sent when creating the account).
password string
The password for the account. (See the user.create API call.)

Request parameters - optional

None.

Response

JSON object as above, showing the details of the user.

No cookie/session is created.

If the user has any special privileges, e.g. a feedback handler or OSM debugger, the privileges field will contain a comma-separated list of privileges, not in any specific order, e.g. osm,feedback. The current special privileges, which are shown to the user in their profile page when they log in to the website, are currently as follows:

  • administrator - all privileges listed here, plus occasional code-specific switches
  • developer - may be used in future for developer-specific features
  • editor - allows editing of user-generated content (e.g. fixing spelling mistakes in Photomap captions)
  • feedback - gives membership of the feedback handling team who debug and respond to route (and other) feedback
  • osm - gives access to features under development, adds debugging links on the journey page, and other debugging screens
  • photooftheday - controls which photos appear as Photo of the day

The privileges field always returns an array - either empty if no privileges, or a simple array of privilege identifer strings (as listed above) if the user has privileges.

Error response

JSON object containing an error key and a text string.

The error string from this method is suitable for passing directly on to the user.

Example errors (text string may vary):

{
    "error": "No validated account matching that username and password was found."
}
{
    "error": "The account for the e-mail you specified has not yet been validated. Please check your e-mail account for the validation link you were sent."
}

We welcome your feedback, especially to report bugs or give us route feedback.

My comments relate to: *






Your comments: *
URL of page: * https://newcastle-under-lyme.cyclestreets.net/api/v2/user.authenticate/
How did you find out about CycleStreets?:
Your name:
Our ref: Please leave blank - anti-spam measure

* Items marked with an asterisk [*] are required fields and must be fully completed.