traqoauth2

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 2 Imported by: 1

README

go-traq-oauth2

GoDoc

Package traqoauth2 provides constants for using OAuth2 to access traQ.

Usage

[!WARNING] OAuth2 Authorization Code Flowに則ったClientを実装する前に、他のより簡単な方法で実装できないか検討してください。

Full example: _example/

package main

import (
  // ...
  traqoauth2 "github.com/traPtitech/go-traq-oauth2"
)

// Configure at https://bot-console.trap.jp/clients
var  oauth2Config = oauth2.Config{
  ClientID:     os.Getenv("TRAQ_CLIENT_ID"),
  ClientSecret: os.Getenv("TRAQ_CLIENT_SECRET"),
  Endpoint:     traqoauth2.Prod, // or traqoauth2.Staging
  RedirectURL:  os.Getenv("TRAQ_REDIRECT_URL"),
  Scopes:       []string{traqoauth2.ScopeRead, traqoauth2.ScopeWrite}
}

Documentation

Index

Constants

View Source
const (
	ScopeOpenID    = "openid"
	ScopeProfile   = "profile"
	ScopeRead      = "read"
	ScopeWrite     = "write"
	ScopeManageBot = "manage_bot"
)

Variables

View Source
var (
	Prod, _    = New("https://q.trap.jp/api/v3")
	Staging, _ = New("https://q-dev.trapti.tech/api/v3")
)

Functions

func New

func New(apiBaseURL string) (oauth2.Endpoint, error)

New returns an Endpoint for the given API base URL.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL