This repository was archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(authService): add default headers and clientSecret in config
Add some default headers to the baseConfig that will be appended when using .login() and .refreshToken(). This is to support IdentityServer 4 with the openId spec http://openid.net/specs/openid-connect-core-1_0.html#TokenRequest. Gives us the posibility to use application/x-www-form-urlencoded as content-type.
- Loading branch information
Mats Grønlid
committed
Feb 2, 2017
1 parent
c119d0c
commit 863e4a4
Showing
4 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
863e4a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
I am running into an issue with the defaultHeadersForTokenRequests.
It seems to be working for the login() method, but not for updateToken(). All the parameters are missing from the updateToken request, which also happens for the initial token request made by login() if I remove the defaultHeadersForTokenRequests: {'Content-Type': 'application/x-www-form-urlencoded'} line.
Here is my set up:
.plugin('aurelia-api', configure => {
configure.registerEndpoint('auth', environment.apiEndpoint, {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
.registerEndpoint('protected-api', environment.apiEndpoint)
.setDefaultEndpoint('protected-api')
})
.plugin('aurelia-authentication', baseConfig => {
baseConfig.configure({
endpoint: 'auth',
configureEndpoints: ['auth','protected-api'],
defaultHeadersForTokenRequests: {'Content-Type': 'application/x-www-form-urlencoded'},
loginUrl: 'token',
authHeader: 'Authorization',
authTokenType: 'Bearer',
httpInterceptor: true,
accessTokenProp: 'access_token',
useRefreshToken: true,
clientId: 'XXXXXXXX',
refreshTokenUrl: 'token',
refreshTokenProp: 'refresh_token',
refreshTokenSubmitProp: 'refresh_token',
autoUpdateToken: true,
storage: 'localStorage',
loginRedirect: '#/home',
logoutRedirect: '#/home',
getExpirationDateFromResponse: (response => { if(response && response.expires_in) return (new Date().getTime() + response.expires_in * 1000)/1000})
})
})
Am I missing something? Please let me know if more details are needed!
Thank you!
863e4a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pllamena could you move this to an issue, and ping @groenlid?
863e4a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I just created issue #358 :)