amazon-cognito-auth-js
amazon-cognito-auth-js copied to clipboard
CodeGrantFlow custom Authorization headers
I am using codegrant flow and everything as per the documentation works, I'm sure I can work around the silent refresh as well based on the provided comments. But the only issue I've been facing is "unable to set my custom headers"
I have to send Authorization as "Basic xxxxxxxxxx" along with 'Content-Type': 'application/x-www-form-urlencoded' as per my requirement. Unfortunately I don't see any feasibility in doing so.
Let me know if you have any other workaround for achieving this. because I made some modifications in the library and it worked for me.
Below are the changes in file:
HEADER: this.headers in constants header = { ...header }; in makePOSTRequest method.
Below is the configuration:
authData: { tenant: 'tenant', ClientId: 'ClientId', AppWebDomain: 'AppWebDomain', TokenScopesArray: ['openid'], RedirectUriSignIn: window.location.origin, UserPoolId: 'UserPoolId', RedirectUriSignOut: window.location.origin, grant_type: 'grant_type', client_secret: 'client_secret', cacheLocation: 'localStorage', IdentityProvider: 'IdentityProvider', AdvancedSecurityDataCollectionFlag: false, headers: { 'Content-Type': 'application/x-www-form-urlencoded', Authorization: 'Basic XDXDXDXGFXHGGFXFXFXFXFXXDXDXDXDXDXDDXDXDX' } }
I have also attached the modified file here.
I have a critical deadline to fix this issue. Appreciate your quick thoughts on this.