Linker OAuth Service

Requirement
Bootstrap Go and Install Go
Install Go1.4 for bootstraping:
git clone https://go.googlesource.com/go ~/go1.4
cd ~/go1.4
git checkout -t origin/release-branch.go1.4
cd src && ./all.bash
export GOROOT_BOOTSTRAP=~/go1.4
Install Go1.8
cp -a ~/go1.4 ~/go
cd ~/go
git checkout -t origin/release-branch.go1.8
cd src && ./all.bash
Setting up Paths
export GOROOT=~/go
export PATH=~/go/bin:$PATH
Build
-
Sync golang dependencies
govendor sync
-
Build the binary
make
To build with go build flags:
make GO_BUILD_FLAGS="-x"
-
Change properties in config/default.json
config config/default.json
-
Setup portal static files
scripts/setup-static-files
-
Run
./lnk-auth 8.8.8.8:3031
./lnk-auth :3031
./lnk-auth -h 8.8.8.8 -p 3031
Run Tests
- first of all, you shoud provide a MongoDB env. I suggest using Docker.
- config mongodb host, port and other configs in
oauth.properties
.
- run
make test
To run tests, please setup your config file and run make test
with the environment variable OAUTH_CONFIG_PATH
:
cp -v $PWD/config/test.json $PWD/config/testing_local.json
vim $PWD/config/testing_local.json
make test OAUTH_CONFIG_PATH="$PWD/config/testing_local.json"
API
/me
: Returns the current user info by the given access token. This API can be used
for the external services.
/v1/signup
:
/v1/signin
:
/v1/dev/auth
Schema
User Schema
_id
(bson.ObjectId): mongo default object id
serial_number
(string): device serial number
email
(string)
password
(string)
first_name
(string)
last_name
(string)
country_code
(string)
cellphone
(string)
verified
(boolean)
verification_code
(string)
jwt
(string): authentication token (tbd ??)
access_token
(string)
access_token_expiry_time
(string)
refresh_token
(string)
created_at
(timestamp)
updated_at
(timestamp)
Applications Schema
_id
(bson.ObjectId): mongo default object id
name
(string): The name of the application.
description
(string): The description of the application.
redirect_uri
(string): oauth app redirect uri
client_id
(string): The client ID, could be generated as an UUID
client_secret
(string): The secret of the client (algorithm TBD)
created_at
- (timestamp)
updated_at
- (timestamp)
user_data
(interface{})
Reference