generate secret method now working as expected