Amplify-js: Tokens not being saved to cookie storage

Created on 30 Jan 2019  路  1Comment  路  Source: aws-amplify/amplify-js

My question is related to cookie storage when using Amplify Auth.

I'm developing a traditional web app using Golang (no js framework) and wanted to get auth tokens to get sent when requesting pages for auth purposes. This is most likely supposed to be handled using cookies but I can't seem to get anything saved in my cookies. I've been reading other issues which show people using the cookieStorage option when configuring Auth but I can't get that to work. I was wondering if I'm doing things right? Sign in and sign out works and I see my tokens in localstorage but no cookies. This is how I'm configuring Auth:

Auth.configure( {
        identityPoolId: "my identity pool id",
        region: "my region",
        userPoolId: "my user pool id",
        userPoolWebClientId: "my web client id",
        cookieStorage: {
            domain: 'http://localhost:8080',
            secure: false
        }
    } );

In Golang, when i try to look at all the cookies in the request sent, there doesn't seem to be any cookies present in the request, nor can I see anything in the cookies section of the Application tab in chrome dev tools.

My only other idea is to setup a service worker and on signin/page load/sign out send a message to the service worker with the id token and then send that in an Authorization header. But this doesn't seem like a very clean/right thing to do. Any ideas on what I'm supposed to do? Or what I'm doing wrong? Thanks

Most helpful comment

My bad, this works. My domain was supposed to be localhost

>All comments

My bad, this works. My domain was supposed to be localhost

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cgarvis picture cgarvis  路  3Comments

ldgarcia picture ldgarcia  路  3Comments

romainquellec picture romainquellec  路  3Comments

callmekatootie picture callmekatootie  路  3Comments

guanzo picture guanzo  路  3Comments