Skip to content

WIP: add google sign in redirect#48

Open
coolaj86 wants to merge 1 commit intomainfrom
oidc-redirect
Open

WIP: add google sign in redirect#48
coolaj86 wants to merge 1 commit intomainfrom
oidc-redirect

Conversation

@coolaj86
Copy link
Contributor

@coolaj86 coolaj86 commented Jan 2, 2022

How to install this pre-release version

npm install 'github:therootcompany/auth3000#600f87d4a'

How to Migration from Client-Side Redirects

JavaScriptless Google Sign In

Now we should be able to get through the Google Sign In process with server-side redirects only.

  1. Update the redirect URL in the Google dashboard: https://console.cloud.google.com/apis/dashboard
  2. Create a link like this:
    <a href="/api/authn/session/oidc/accounts.google.com/redirect">Google Sign-In</a>
  3. Then check the URL query params for errors. If none, try to get a token.
    let errmsg = new URL(document.location.href).searchParams.get('error');
    if (errmsg) {
      window.alert(errmsg);
      return;
    }
    let resp = fetch("http://localhost:3042/api/authn/refresh", {
      "referrerPolicy": "strict-origin-when-cross-origin",
      "method": "POST",
      "mode": "cors",
      "credentials": "include"
    });
    let tokens = await resp.json();
    console.info(tokens.id_token, tokens.access_token);

@coolaj86 coolaj86 linked an issue Jan 4, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server-side redirects for Google Sign-In

1 participant