finally got the authentication flow to work