Understanding the username-Password oauth authentication Flow

Source: Internet
Author: User
Tags oauth

User name-Password Authentication flow can be used for identity authentication when the user has the user's creden. In this process, the user's creden are used by the application to request an access token, as shown in the following steps.

The oauth stream transmits user creden。 back and forth. Use this authentication stream only when necessary. The refresh tag is released.

1. the application uses the user's username and password to request an access token. this is done via an out-of-band POST request to the appropriate Salesforce (Customer Management System) token request endpoint, suchHttps://login.salesforce.com/services/oauth2/token. The following request fields (field) are required:

An example request body might look something like the following:

grant_type=password&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=1955279925675241571&username=testuser%40salesforce.com&password=mypassword123456

Salesforce verifies (verification) The user credentials, and if successful, sends a response to the application with the access token. This response contains the following values:

An example response body might look something like:

{"id":"https://login.salesforce.com/id/00Dx0000000BV7z/005x00000012Q9P","issued_at":"1278448832702","instance_url":"https://na1.salesforce.com","signature":"0CmxinZir53Yex7nE0TD+zMpvIWYGb/bdJh6XfOH6EQ=","access_token":"00Dx0000000BV7z!AR8AQAxo9UfVkh8AlV0Gomt9Czx9LjHnSSpwBMmbRcgKFmxOtvxjTrKW19ye6PE3Ds1eQz3z8jr3W7_VbWmEu4Q8TVGSTHxs"}

3. The application users the provided access token to access protected user data. Keep the following considrations in mind when using the User-Agent oauth flow:

Since the user is never redirected to login at Salesforce in this flow, the user can't directly authorize the application, so no refresh tokens can be used. if your application requires refresh tokens, you shoshould consider using the Web server or User-Agent oauth flow.

 

Reprinted from: http://www.salesforce.com/us/developer/docs/api_rest/Content/intro_understanding_username_password_oauth_flow.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.