Skip to content

Commit

Permalink
fix support for retrieving AuthData from URL params
Browse files Browse the repository at this point in the history
  • Loading branch information
Răzvan Mitre committed Sep 22, 2016
1 parent 1d02651 commit 93ddf3b
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/angular2-token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class Angular2TokenService implements CanActivate {
}

// Construct and send Http request
sendHttpRequest(requestOptions: RequestOptions): Observable<Response> {
sendHttpRequest(requestOptions: RequestOptions): Observable<Response> {

let headers: Headers;
let baseRequestOptions: RequestOptions;
Expand Down Expand Up @@ -327,22 +327,18 @@ export class Angular2TokenService implements CanActivate {

// Try to get auth data from url parameters.
private _getAuthDataFromParams() {
this._activatedRoute.queryParams.subscribe(queryParams => {
let authData: AuthData = {
accessToken: queryParams['token'],
client: queryParams['client_id'],
expiry: queryParams['expiry'],
tokenType: 'Bearer',
uid: queryParams['uid']
};

if (this._activatedRoute.params != null) { // Fix for Testing, has to be removed later

let params = this._activatedRoute.params;

let authData: AuthData = {
accessToken: params['token'],
client: params['client_id'],
expiry: params['expiry'],
tokenType: 'Bearer',
uid: params['uid']
};

if (this._checkIfComplete(authData))
this._currentAuthData = authData;
}
if (this._checkIfComplete(authData))
this._currentAuthData = authData;
});
}


Expand Down

0 comments on commit 93ddf3b

Please sign in to comment.