Skip to content

Instantly share code, notes, and snippets.

@michaeldelorenzo
Created April 8, 2017 12:10
Show Gist options
  • Save michaeldelorenzo/3c262c7bdd736b1a2ac6fa6e3fa8d104 to your computer and use it in GitHub Desktop.
Save michaeldelorenzo/3c262c7bdd736b1a2ac6fa6e3fa8d104 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/ory-am/hydra/sdk"
"log"
)
const clientID = "150e7592-8b54-47f9-80fc-ba2af28762f3"
const clientSecret = ""
const state = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
func main() {
hydraClient, err := sdk.Connect(
sdk.ClientID(clientID),
sdk.ClientSecret(clientSecret),
sdk.ClusterURL("http://localhost:4444"),
sdk.SkipTLSVerify(),
)
if err != nil {
log.Fatalln(err.Error())
}
authURL := hydraClient.OAuth2Config("http://localhost:4445/callback", "offline", "openid").AuthCodeURL(state) + "&nonce=" + state
log.Println("Auth URL: ", authURL)
}
-[ RECORD 1 ]--+-------------------------------------------------------------
id | 150e7592-8b54-47f9-80fc-ba2af28762f3
client_name | My Awesome Public Client 2!
client_secret | $2a$10$6FZjMSYNV.7zByD44ieOwOms492OpzNFQL2ohGjAIpjpg04vf70QW
redirect_uris | urn:ietf:wg:oauth:2.0:oob
grant_types | implicit|refresh_token|password|client_credentials
response_types | id_token|token|code
scope | offline hydra openid
owner | :BdRkm/;hOO2
policy_uri |
tos_uri |
client_uri |
logo_uri |
contacts |
public | t
oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client","statusCode":400}
exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment