Open ashwinikumar07 opened 1 month ago
Can anyone help me on this?
const authHeaders = {
Authorization: `Bearer ${token}`, <-- we use authorizer lambda, change as necessary
host: `${host.replace('https://', '').replace('/graphql', '')}`, // need to strip the 'https://' and '/graphql' from your appsync http url
// can specify any other custom headers
};
const encodedHeaders = btoa(JSON.stringify(authHeader));
const emptyPayload = btoa(JSON.stringify({}));
// we use rxjs WebSocket wrapper for WebSocket()
return this.wsFactory.makeSocket({
url: `${your_websocket_url}?header=${encodedHeaders}&payload=${emptyPayload}`,
protocol: 'graphql-ws',
openObserver: {
next: () => {
this.webSocket$!.next({ type: 'connection_init' });
},
},
closeObserver: {
next: () => {},
},
});
@jbbasson I am using IAM appsync auth and getting the above error.
we had to strip the https://
prefix and /graphql
post fix from the https endpoint of appsync before setting is as the host in the auth header
@jbbasson I tried strip the https:// prefix and /graphql post fix from the https endpoint of appsync. But still getting the same error.
can you show your current version of code?
You are not authorized to make this call
I am trying to create aws appsync subscription with IAM auth. I am able to query/mutation the appsync with the same IAM credentials, but getting the exception on websocket connection.