Skip to content

Commit 819dd57

Browse files
committed
Merge branch 'authorizerdev/authorizer:main' into main
2 parents 044b025 + 41b5f00 commit 819dd57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3325
-239
lines changed

.github/workflows/release.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
on:
2+
workflow_dispatch:
3+
inputs:
4+
logLevel:
5+
description: 'Log level'
6+
required: true
7+
default: 'warning'
8+
type: choice
9+
options:
10+
- info
11+
- warning
12+
- debug
13+
tags:
14+
description: 'Tags'
15+
required: false
16+
type: boolean
217
release:
318
types: [created]
419

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ data.db
1111
.DS_Store
1212
.env.local
1313
*.tar.gz
14-
.vscode/
14+
.vscode/
15+
.yalc
16+
yalc.lock

README.md

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,50 @@
5959

6060
# Getting Started
6161

62-
## Trying out Authorizer
62+
## Step 1: Get Authorizer Instance
6363

64-
This guide helps you practice using Authorizer to evaluate it before you use it in a production environment. It includes instructions for installing the Authorizer server in local or standalone mode.
64+
### Deploy Production Ready Instance
65+
66+
Deploy production ready Authorizer instance using one click deployment options available below
67+
68+
| **Infra provider** | **One-click link** | **Additional information** |
69+
| :----------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------: |
70+
| Railway.app | <a href="https://railway.app/new/template?template=https://github.com/authorizerdev/authorizer-railway&amp;plugins=postgresql,redis"><img src="https://railway.app/button.svg" style="height: 44px" alt="Deploy on Railway"></a> | [docs](https://docs.authorizer.dev/deployment/railway) |
71+
| Heroku | <a href="https://heroku.com/deploy?template=https://github.com/authorizerdev/authorizer-heroku"><img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku" style="height: 44px;"></a> | [docs](https://docs.authorizer.dev/deployment/heroku) |
72+
| Render | [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/authorizerdev/authorizer-render) | [docs](https://docs.authorizer.dev/deployment/render) |
73+
74+
### Deploy Authorizer Using Source Code
6575

66-
- [Install using source code](#install-using-source-code)
67-
- [Install using binaries](#install-using-binaries)
68-
- [Install instance on heroku](#install-instance-on-Heroku)
69-
- [Install instance on railway.app](#install-instance-on-railway)
76+
This guide helps you practice using Authorizer to evaluate it before you use it in a production environment. It includes instructions for installing the Authorizer server in local or standalone mode.
7077

71-
## Install using source code
78+
#### Install using source code
7279

73-
### Prerequisites
80+
#### Prerequisites
7481

7582
- OS: Linux or macOS or windows
7683
- Go: (Golang)(https://golang.org/dl/) >= v1.15
7784

78-
### Project Setup
85+
#### Project Setup
7986

8087
1. Fork the [authorizer](https://github.com/authorizerdev/authorizer) repository (**Skip this step if you have access to repo**)
8188
2. Clone repo: `git clone https://github.com/authorizerdev/authorizer.git` or use the forked url from step 1
8289
3. Change directory to authorizer: `cd authorizer`
83-
5. Create Env file `cp .env.sample .env`. Check all the supported env [here](https://docs.authorizer.dev/core/env/)
84-
6. Build Dashboard `make build-dashboard`
85-
7. Build App `make build-app`
86-
8. Build Server `make clean && make`
90+
4. Create Env file `cp .env.sample .env`. Check all the supported env [here](https://docs.authorizer.dev/core/env/)
91+
5. Build Dashboard `make build-dashboard`
92+
6. Build App `make build-app`
93+
7. Build Server `make clean && make`
8794
> Note: if you don't have [`make`](https://www.ibm.com/docs/en/aix/7.2?topic=concepts-make-command), you can `cd` into `server` dir and build using the `go build` command
88-
9. Run binary `./build/server`
95+
8. Run binary `./build/server`
8996

90-
## Install using binaries
97+
### Deploy Authorizer using binaries
9198

9299
Deploy / Try Authorizer using binaries. With each [Authorizer Release](https://github.com/authorizerdev/authorizer/releases)
93100
binaries are baked with required deployment files and bundled. You can download a specific version of it for the following operating systems:
94101

95102
- Mac OSX
96103
- Linux
97104

98-
### Step 1: Download and unzip bundle
105+
#### Download and unzip bundle
99106

100107
- Download the Bundle for the specific OS from the [release page](https://github.com/authorizerdev/authorizer/releases)
101108

@@ -115,11 +122,7 @@ binaries are baked with required deployment files and bundled. You can download
115122
cd authorizer
116123
```
117124

118-
### Step 2: Configure environment variables
119-
120-
Required environment variables are pre-configured in `.env` file. But based on the production requirements, please configure more environment variables. You can refer to [environment variables docs](/core/env) for more information.
121-
122-
### Step 3: Start Authorizer
125+
#### Step 3: Start Authorizer
123126

124127
- Run following command to start authorizer
125128

@@ -131,20 +134,20 @@ Required environment variables are pre-configured in `.env` file. But based on t
131134

132135
> Note: For mac users, you might have to give binary the permission to execute. Here is the command you can use to grant permission `xattr -d com.apple.quarantine build/server`
133136
134-
Deploy production ready Authorizer instance using one click deployment options available below
137+
## Step 2: Setup Instance
135138

136-
| **Infra provider** | **One-click link** | **Additional information** |
137-
| :----------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------: |
138-
| Railway.app | <a href="https://railway.app/new/template?template=https://github.com/authorizerdev/authorizer-railway&amp;plugins=postgresql,redis"><img src="https://railway.app/button.svg" style="height: 44px" alt="Deploy on Railway"></a> | [docs](https://docs.authorizer.dev/deployment/railway) |
139-
| Heroku | <a href="https://heroku.com/deploy?template=https://github.com/authorizerdev/authorizer-heroku"><img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy to Heroku" style="height: 44px;"></a> | [docs](https://docs.authorizer.dev/deployment/heroku) |
140-
| Render | [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/authorizerdev/authorizer-render) | [docs](https://docs.authorizer.dev/deployment/render) |
139+
- Open authorizer instance endpoint in browser
140+
- Sign up as an admin with a secure password
141+
- Configure environment variables from authorizer dashboard. Check env [docs](/core/env) for more information
142+
143+
> Note: `DATABASE_URL`, `DATABASE_TYPE` and `DATABASE_NAME` are only configurable via platform envs
141144
142145
### Things to consider
143146

144147
- For social logins, you will need respective social platform key and secret
145148
- For having verified users, you will need an SMTP server with an email address and password using which system can send emails. The system will send a verification link to an email address. Once an email is verified then, only able to access it.
146149
> Note: One can always disable the email verification to allow open sign up, which is not recommended for production as anyone can use anyone's email address 😅
147-
- For persisting user sessions, you will need Redis URL (not in case of railway.app). If you do not configure a Redis server, sessions will be persisted until the instance is up or not restarted. For better response time on authorization requests/middleware, we recommend deploying Redis on the same infra/network as your authorizer server.
150+
- For persisting user sessions, you will need Redis URL (not in case of railway app). If you do not configure a Redis server, sessions will be persisted until the instance is up or not restarted. For better response time on authorization requests/middleware, we recommend deploying Redis on the same infra/network as your authorizer server.
148151

149152
## Testing
150153

@@ -163,8 +166,9 @@ This example demonstrates how you can use [`@authorizerdev/authorizer-js`](/auth
163166

164167
<script type="text/javascript">
165168
const authorizerRef = new authorizerdev.Authorizer({
166-
authorizerURL: `AUTHORIZER_URL`,
169+
authorizerURL: `YOUR_AUTHORIZER_INSTANCE_URL`,
167170
redirectURL: window.location.origin,
171+
clientID: 'YOUR_CLIENT_ID', // obtain your client id from authorizer dashboard
168172
});
169173
170174
// use the button selector as per your application
@@ -175,15 +179,19 @@ This example demonstrates how you can use [`@authorizerdev/authorizer-js`](/auth
175179
});
176180
177181
async function onLoad() {
178-
const res = await authorizerRef.browserLogin();
179-
if (res && res.user) {
182+
const res = await authorizerRef.authorize({
183+
response_type: 'code',
184+
use_refresh_token: false,
185+
});
186+
if (res && res.access_token) {
180187
// you can use user information here, eg:
181-
/**
182-
const userSection = document.getElementById('user');
183-
const logoutSection = document.getElementById('logout-section');
184-
logoutSection.classList.toggle('hide');
185-
userSection.innerHTML = `Welcome, ${res.user.email}`;
186-
*/
188+
const user = await authorizerRef.getProfile({
189+
Authorization: `Bearer ${res.access_token}`,
190+
});
191+
const userSection = document.getElementById('user');
192+
const logoutSection = document.getElementById('logout-section');
193+
logoutSection.classList.toggle('hide');
194+
userSection.innerHTML = `Welcome, ${user.email}`;
187195
}
188196
}
189197
onLoad();

app/package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function App() {
2121
if (redirectURL) {
2222
urlProps.redirectURL = redirectURL;
2323
} else {
24-
urlProps.redirectURL = window.location.origin;
24+
urlProps.redirectURL = window.location.origin + '/app';
2525
}
2626
const globalState: Record<string, string> = {
2727
// @ts-ignore

app/src/Root.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useEffect, lazy, Suspense } from 'react';
22
import { Switch, Route } from 'react-router-dom';
33
import { useAuthorizer } from '@authorizerdev/authorizer-react';
4+
import SetupPassword from './pages/setup-password';
45

56
const ResetPassword = lazy(() => import('./pages/rest-password'));
67
const Login = lazy(() => import('./pages/login'));
@@ -60,6 +61,9 @@ export default function Root({
6061
<Route path="/app/reset-password">
6162
<ResetPassword />
6263
</Route>
64+
<Route path="/app/setup-password">
65+
<SetupPassword />
66+
</Route>
6367
</Switch>
6468
</Suspense>
6569
);

app/src/pages/setup-password.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React, { Fragment } from 'react';
2+
import { AuthorizerResetPassword } from '@authorizerdev/authorizer-react';
3+
4+
export default function SetupPassword() {
5+
return (
6+
<Fragment>
7+
<h1 style={{ textAlign: 'center' }}>Setup new Password</h1>
8+
<br />
9+
<AuthorizerResetPassword />
10+
</Fragment>
11+
);
12+
}

0 commit comments

Comments
 (0)