|
há 4 meses | |
---|---|---|
cmd/mailer | há 9 meses | |
examples | há 9 meses | |
kvdb | há 5 meses | |
mockid | há 5 meses | |
public | há 5 meses | |
vendor | há 5 meses | |
xkeypairs | há 5 meses | |
.gitignore | há 5 meses | |
.ignore | há 7 meses | |
.prettierignore | há 5 meses | |
LICENSE | há 1 ano | |
README.md | há 4 meses | |
default.jwk.json | há 10 meses | |
go-test.sh | há 7 meses | |
go.mod | há 5 meses | |
go.sum | há 5 meses | |
mockid.go | há 7 meses |
OAuth2 / JWT / OpenID Connect for mocking auth... which isn't that different from doing it for real, actually.
Example Web App
and accept its generated IDAdd your test domain
Domain Verification
from the left hand side of the screenbeta.example.com
), but a domain that you actually ownVerify Ownership
Enable OAuth2
OAuth consent screen
External
Create Google Credentials
Credentials
from the left sidebarOAuth ID
Web Application
Update your signin page.
profile email
) and client ID in the meta tag of your login page HTML. profile
is the minimum scope and is always returned.<head>
<meta name="google-signin-scope" content="email">
<meta
name="google-signin-client_id"
content="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
/>
</head>
<script src="https://apis.google.com/js/platform.js" async defer></script>
data-onsuccess
callback. You can also adjust the data-scope
per button to include more stuff. Scopes are defined at https://developers.google.com/identity/protocols/oauth2/scopes<div
class="g-signin2"
data-onsuccess="ongsignin"
data-scope="profile email https://www.googleapis.com/auth/spreadsheets.readonly https://www.googleapis.com/auth/drive.readonly"
></div>
<script>
window.ongsignin = function (gauth) {
// Note: this is a special prototype-style instance object with few
// enumerable properties (which don't make sense). Requires API docs.
// See https://developers.google.com/identity/sign-in/web
console.log(goauth)
};
</script>
Authorization
header, the inspect token URL only supports the query parameter: GET https://oauth2.googleapis.com/tokeninfo?id_token=<token>
gapi.auth2.getAuthInstance().signOut().then(function() { });