Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WIP: add google # redirect #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

WIP: add google # redirect #48

wants to merge 1 commit into from

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 #

Now we should be able to get through the Google # 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
# for free to join this conversation on GitHub. Already have an account? # 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