svelte-social-auth icon indicating copy to clipboard operation
svelte-social-auth copied to clipboard

Support more options for Google Auth

Open FunMiles opened this issue 4 years ago • 0 comments

Google Auth has several more options that are not exposed. In particular for Server/Client cases where the user wants to authorize the server to make API calls, being able to obtain a code that the server can use to obtain a token and a renew token is important. The React package react-google-login offers

<GoogleLogin
        clientId="your-client-id"
        onSuccess={handleGoogleResponse}
        onFailure={handleGoogleResponse}
        cookiePolicy={'single_host_origin'}
        accessType='offline' // To get a non-expiring refresh token
        prompt='consent' // To force the code to allow to obtain a refresh-token each time (otherwise only the first in a session will get a refresh-token
        responseType='code' // Obtain a code to pass to the server
      />;

An added benefit is that the code method is safer than passing a token as documented by Google.

FunMiles avatar Dec 27 '20 16:12 FunMiles