File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 120
120
document . getElementById ( 'quickstart-sign-in' ) . addEventListener ( 'click' , toggleSignIn , false ) ;
121
121
}
122
122
123
+ function getHashValue ( key ) {
124
+ var matches = location . hash . match ( new RegExp ( key + '=([^&]*)' ) ) ;
125
+ return matches ? matches [ 1 ] : null ;
126
+ }
127
+
123
128
window . onload = function ( ) {
124
129
initApp ( ) ;
130
+
131
+ // If a token has been passed in the hash fragment we display it in the UI and start the sign in process.
132
+ document . getElementById ( 'tokentext' ) . value = getHashValue ( 'token' ) || '' ;
133
+ if ( document . getElementById ( 'tokentext' ) . value ) {
134
+ firebase . auth ( ) . signInWithCustomToken ( getHashValue ( 'token' ) ) ;
135
+ }
125
136
} ;
126
137
</ script >
127
138
</ head >
Original file line number Diff line number Diff line change 71
71
document . getElementById ( 'tokenbox' ) . textContent = sJWT ;
72
72
console . log ( sJWT ) ;
73
73
74
- var link = '<a href="../index .html?tok =' + sJWT + '">Use this token in the web custom auth example</a>' ;
74
+ var link = '<a href="../customauth .html#token =' + sJWT + '">Use this token in the web custom auth example</a>' ;
75
75
document . getElementById ( 'linktokenbox' ) . innerHTML = link ;
76
76
}
77
77
@@ -131,9 +131,9 @@ <h2 class="mdl-card__title-text">Token Generator</h2>
131
131
</ div >
132
132
< div class ="mdl-card__supporting-text mdl-color-text--grey-600 " id ="notoken ">
133
133
< p >
134
- In order to generate a token you'll need to use a service account JSON file provided
135
- by the < a href ="https://console.developers.google.com "> Google Developers Console</ a > view
136
- of your Firebase project. We recommend that once you're done testing with this tool you
134
+ In order to generate a token you'll need to use a service account JSON file provided by the
135
+ < a href ="https://console.developers.google.com/apis/credentials/serviceaccountkey?project=_ "> Google Developers Console</ a >
136
+ view of your Firebase project. We recommend that once you're done testing with this tool you
137
137
delete the service account you made, and create a fresh one for the integration with your
138
138
actual authentication system.
139
139
</ p >
You can’t perform that action at this time.
0 commit comments