This addon allows your Ember.js app to authenticate with Salesforce using Torii.
To install the addon run:
ember install torii-salesforce-oauth2
After that add the appropriate configurations to your config/environment.js
:
module.exports = function(environment) {
var ENV = {
torii: {
providers: {
'salesforce-oauth2': {
apiKey: 'your_client_id',
redirectUri: 'http://localhost:4200',
scope: 'api refresh_token'
}
}
/* ... */
See Torii and Salesforce docs for more.
The authorization code that is returned by Salesforce is URL encoded and needs to be decoded before using it to obtain an access token if your torii version is lower than 0.9.5:
this.get('torii').open('salesforce-oauth2').then(
(authorization) => {
let authCode = decodeURIComponent(authorization.authorizationCode);
// ...
}
);
Since 0.9.5 this is handled in torii, see https://github.com/Vestorly/torii/pull/376.
git clone
this repositorycd torii-salesforce-oauth2
yarn install
ember test
– Runs the test suite on the current Ember versionember test --server
– Runs the test suite in "watch mode"ember try:each
– Runs the test suite against multiple Ember versions
ember serve
- Visit the dummy application at http://localhost:4200.
This project is licensed under the MIT License.