33< head >
44 < meta charset ="utf-8 ">
55 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
6- < title > Solid Auth Test Page </ title >
6+ < title > Solid Auth Demo App </ title >
77 <!-- Bootstrap CSS and Theme for demo purposes -->
88 < link rel ="stylesheet " href ="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css " />
99 <!-- Solid Demo template/stylesheet -->
1717 < h3 > Solid Auth Demo Page</ h3 >
1818 </ div >
1919 < div class ="demo-section " style ="width: 100%; ">
20- < p > Option 1: Login on the same page (in iframe), allow main window redirect.</ p >
20+ < p > Login Option 1: Login on the same page (in iframe), allow main window
21+ redirect.</ p >
2122 < iframe id ="solidLogin " src ="login_iframe_inline.html " seamless style ="width: 100%; border: none; margin-top: 1em; "> </ iframe >
2223 </ div >
2324 < div class ="demo-section ">
@@ -27,13 +28,19 @@ <h5>App body</h5>
2728</ div >
2829</ body >
2930< script >
30- var auth = new SolidAuth ( )
31+ var solid = { auth : new SolidAuth ( ) }
3132
32- document . addEventListener ( 'DOMContentLoaded' , function ( ) { init ( ) } )
33-
34- function init ( ) {
35- window . addEventListener ( 'message' , auth . onMessage . bind ( auth ) )
36- auth . detectAuthCallback ( )
37- }
33+ // Using a standard "document loaded" event listener
34+ // (equivalent to jQuery's $(document).ready()
35+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
36+ // Init the solid auth helper, inject whatever behavior you want to happen
37+ // when authentication succeeds.
38+ solid . auth . init ( {
39+ onLoginSuccess : function ( webId , accessToken ) {
40+ console . log ( 'onLoginSuccess() callback! webId: ' , webId ,
41+ 'access_token: ' , accessToken )
42+ }
43+ } )
44+ } )
3845</ script >
3946</ html >
0 commit comments