Last active
June 7, 2017 22:28
-
-
Save mdeggies/f6b842cffbeef308493fe724557919ba to your computer and use it in GitHub Desktop.
Revisions
-
Michele Degges revised this gist
Jun 7, 2017 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,25 +25,26 @@ baseUrl: 'https://dev-<ID>.oktapreview.com', // OpenID Connect options clientId: '<OIDC CLIENT ID>', redirectUri: 'http://localhost:<PORT>', authParams: { responseType: ['id_token', 'token'] } });/ oktaSignIn.renderEl({ el: '#okta-login-container' }, function (res) { console.log('Status:',res.status); if (res.status === 'SUCCESS') { console.log('User: ',res.user); console.log('Response contains access token and ID token: ',res); // Pass the access token to your routes to give the user access to different pages, // or pass the ID token to get information about the current user } }, function (err) { console.log('Error: ',err); }); </script> </body> -
Michele Degges created this gist
Jun 7, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ <!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Example Okta Sign-In Widget</title> <!--[if lt IE 9]> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script> <![endif]--> <script src="https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/1.7.0/js/okta-sign-in.min.js" type="text/javascript"></script> <link href="https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/1.7.0/css/okta-sign-in.min.css" type="text/css" rel="stylesheet"> <!-- Optional, customizable css theme options. Link your own customized copy of this file or override styles in-line --> <link href="https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/1.7.0/css/okta-theme.css" type="text/css" rel="stylesheet"> </head> <body> <!-- Render the login widget here --> <div id="okta-login-container"></div> <!-- Script to init the widget --> <script> var oktaSignIn = new OktaSignIn({ baseUrl: 'https://dev-<ID>.oktapreview.com', // OpenID Connect options clientId: '<OIDC CLIENT ID>', redirectUri: 'https://dev-<ID>.oktapreview.com/oauth2/v1/authorize/callback', authParams: { responseType: 'id_token', } }); oktaSignIn.renderEl({ el: '#okta-login-container' }, function (res) { console.log('Status:',res.status); if (res.status === 'SUCCESS') { console.log('User:',res.user); } // res.idToken - id_token generated // res.claims - decoded id_token information }, function (err) { console.log('Error:',err); }); </script> </body> </html>