Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dont send token to non-portal #23

Merged
merged 1 commit into from
Sep 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Fixed
* Use Portal Host instead of current domain to determine whether token should fly

## 0.4.8
### Fixed
* Catch exception in token logic
Expand Down
2 changes: 1 addition & 1 deletion addon/mixins/ags-service-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default Ember.Mixin.create({
* Make an arbitrary request to the server
*/
request (url, options = {}) {
if (shouldAddToken(url, this.get('session.portal.id'))) {
if (shouldAddToken(url, this.get('session.portal.id'), this.get('session.portal.portalHostname'))) {
options.token = this.get('session.token');
}
// options.token = this.get('session.token');
Expand Down
6 changes: 3 additions & 3 deletions addon/utils/should-add-token.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export default function shouldAddToken (url, portalId = '') {
export default function shouldAddToken (url, portalId = '', portalHost) {
// if this is a hosted service that belongs to the user's organization
// if this is a service with stored credentials
const id = portalId.toLowerCase();
if (location && location.host) {
return hostsMatch(location.host, url);
if (portalHost) {
return hostsMatch(portalHost, url);
} else {
return (
!!url.toLowerCase().match('arcgis.com/arcgis/rest/services') ||
Expand Down