Skip to content
Authentication Samples in Go
Branch: master
Clone or download

Latest commit

Latest commit 3ee8389 Mar 12, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
oauth-authorization-code initial commit Mar 12, 2020
oidc-authorization-code initial commit Mar 12, 2020
LICENSE initial commit Mar 12, 2020 initial commit Mar 12, 2020

Twitch Authentication Go Samples

Here you will find sample Go apps illustrating how to authenticate Twitch API calls using the OAuth2 and OIDC authorization code flows, as well as the OAuth2 client credentials flow.


$ go get -u


Before running each sample, you will need to set two configuration variables at the top of main.go:

  1. CLIENT_ID - This is the Client ID of your registered application. You can register an application in your dashboard.
  2. CLIENT_SECRET - This is the secret generated for you when you register your application; do not share this. In a production environment, it is STRONGLY recommended that you do not store application secrets in your source code.

Optionally, you may modify the requested scopes and/or claims.

After setting these variables, you may run the server from within each directory:

$ go run main.go

The access token will be shown in the console.


Copyright 2018, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You can’t perform that action at this time.