Add sign-in and a /home page to a website
- 1.Open your product, then Applications, and choose Add Website.
- 2.Give it a name, such as
Notes Website, and an Id, such asweb, and save it. The website's page opens. - 3.In the website's Client auth section, choose Create login registration.
- 4.Under Redirect URIs, add the address your site receives people at after they sign in, such as
/callbackon your site's own address. While you develop, an address onlocalhostworks too. - 5.Under Allowed return origins, add your site's own address.
- 6.Choose Save. The section now shows a client id. Your website sends this with every sign-in, so copy it.
- 1.Open your product's Users, then Authentication.
- 2.Leave Allow sign-in on. Turning it off stops everyone from signing in.
- 3.Leave Email and password on if people may sign in with an email address and a password. Turn it off to allow only the sign-in providers below.
- 4.Under OAuth providers, leave on each provider people may sign in with. The list shows the providers your hub offers, which can include GitHub, Google, Apple, GitLab and Microsoft. Keep at least one of them on.
- 5.Save your changes.
The Sign-up mode setting, in the same place, decides who may create an account:
- Open. Anyone who can sign in can create an account.
- Invite only. Only people you have invited can create an account. A new product starts here, so nobody can sign up until you invite them or open sign-up.
- Closed. Nobody new can create an account. People who already have one still sign in.
Choose the mode that suits your product, and save it. The hub's sign-in page offers Create account in every mode but Closed.
Do this when sign-up is Invite only. With Open or Closed, invitations are not checked, so skip it.
- 1.Open your product's Users, then Pending users, and choose Add users.
- 2.Type each person's name and email address. Add a phone number too if you want to send the invitation by text. The hub matches an invitation by its email address, so nobody can sign up with an invitation that has only a phone number.
- 3.Select the people to invite, and choose Send invitation. Add a note if you like, and send the invitation by email, text message or both.
Each invitation lasts fourteen days, and Invites shows where each one stands. An invited person creates their account on your site's sign-in page with the email address the invitation went to.
Your site now needs three things. Any OpenID Connect client library that supports PKCE does the first two for you, and the client id is the only setting it needs from the hub.
- 1.Send people to sign in. When someone opens
/homeand your site holds no token for them, your site asks the hub for your product's sign-in details, using your client id. It then sends the person to the hub's sign-in page, saying where to send them back. - 2.Receive them at /callback. The hub sends the person back with a one-time code. Your site trades the code for a token, keeps the token, and then sends the person on to
/home. - 3.Show /home. Your site asks the hub who the token belongs to. When the hub answers with the person's name and email address, your site shows the page. When it refuses the token, your site sends the person to sign in again.
Open
/homein a fresh browser. You land on the hub's sign-in page for your product, and after signing in you are back on/home, signed in.