Authentification can be done in various ways.
With a JW-Token, with oAuth2 by a baseauthentification etc.
Try to get a better knowledge about JWT and oAuth2!
| Command | Usage |
|---|---|
| 1. Get Siam-OAuth2-Fake-Server Repository from Azure (Not the main branch, the gifty branch is needed!) 2. Set up .env-File (Siam-Port and REDIRECT_URI=‘http://localhost:<“your-router-port”>/callback’) 3. Tipp: Setup Cookie Session to save the Token. | How to get the remote Repo from Azure: $ git clone –branch gifty –single-branch git@ssh.dev.azure.com:v3/schwarzit/schwarzit.phpc/siam-oauth2-fake-server Go into the repository: $ cd siam-oauth2-fake-server Install dependencies $ npm install Run the container $ docker-compose up -d (check the docker-compose.yaml if any errors) Start server $ node server.js Server started at http://localhost:1234 |
In your config.go Path:
package config
import "golang.org/x/oauth2"
type Config struct {
SiamLoginConfig oauth2.Config
}
var AppConfig Config
func SiamConfig() oauth2.Config {
err := godotenv.Load(".env")
if err != nil {
log.Fatalf("Some error occured. Err: %s", err)
}
AppConfig.SiamLoginConfig = oauth2.Config{
RedirectURL: os.Getenv("REDIRECT_URI"),
ClientID: os.Getenv("CLIENT_ID"),
ClientSecret: os.Getenv("CLIENT_SECRET"),
Scopes: []string{os.Getenv("CLIENT_SCOPE")},
Endpoint: oauth2.Endpoint{
AuthURL: "http://localhost:3000/authz",
TokenURL: "http://localhost:3000/token",
},
}
return AppConfig.SiamLoginConfig
}
Use the share button below if you liked it.
It makes me smile, when I see it.