Skip to content

Instantly share code, notes, and snippets.

@devinsays
Last active November 4, 2019 21:21
Show Gist options
  • Save devinsays/239c10abfb4925d824d18b4866e2423e to your computer and use it in GitHub Desktop.
Save devinsays/239c10abfb4925d824d18b4866e2423e to your computer and use it in GitHub Desktop.
Example Okta Code for Debugging
<html>
<head>
<title>Okta Test</title>
<!-- Latest CDN production Javascript and CSS -->
<script src="https://global.oktacdn.com/okta-signin-widget/3.2.0/js/okta-sign-in.min.js" type="text/javascript"></script>
<link href="https://global.oktacdn.com/okta-signin-widget/3.2.0/css/okta-sign-in.min.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<h1>Okta Testing</h1>
<div id="widget-container"></div>
<script>
var signIn = new OktaSignIn({
baseUrl: 'https://nanoapp.oktapreview.com',
el: '#widget-container',
authParams: {
pkce: true,
issuer: 'https://nanoapp.oktapreview.com/oauth2/default'
}
});
signIn.showSignInToGetTokens({
clientId: '0oao49otuaQgpXWtD0h7',
// Must be in the list of redirect URIs enabled for the OIDC app.
redirectUri: 'https://okta-web.valet/index.html',
// Return an access token from the authorization server.
getAccessToken: true,
// Return an ID token from the authorization server.
getIdToken: true,
scope: 'openid profile'
});
const accessToken = signIn.tokenManager.get('access_token');
console.log('Access token:');
console.log(accessToken);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment