Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Showing posts with label JWT. Show all posts
Showing posts with label JWT. Show all posts

Monday, April 24, 2017

Apps Script Ionic Verify Firebase ID Token


Create apps.gs to do the following:
1) Web Request Handler
2) Web Command to output Ionic HTML apps containing Firebase Authentication service
3) Web Command to receive JWT containing Firebase ID Token
4) Evaluate JWT token
5) Return TRUE or FALSE

Create index.html to do the following;
1) Ionic HTML5 apps


apps.gs





index.html

201704, 20170423, JWT, FIREBASE, IONIC

Apps Script Verify Firebase ID tokens using a third-party JWT library


Firebase ID tokens on clients

When a user or device successfully signs in, Firebase creates a corresponding ID token that uniquely identifies them and grants them access to several resources, such as Firebase Realtime Database and Cloud Storage. You can re-use that ID token to identify the user or device on your custom backend server. To retrieve the ID token from the client, make sure the user is signed in and then get the ID token from the signed-in user.

(Reference: https://firebase.google.com/docs/auth/admin/verify-id-tokens )

Firebase ID token example

The following is an example of Firebase Id Token (JWT)  that has been pasted to jwt.io and got itself decoded by jwt.io



How to verify using jwt.io? 

Read here: https://programming-steps.blogspot.com/2017/04/how-to-verify-firebase-id-tokens-using.html

Verifying Firebase ID using Google Apps Script with jsrsasign JWT Library




201704, 20170423, JWT, FIREBASE

How To Verify Firebase ID tokens using a third-party JWT library?



jwt.io provides a page to help verify Firebase ID Token


Firebase ID tokens on clients

When a user or device successfully signs in, Firebase creates a corresponding ID token that uniquely identifies them and grants them access to several resources, such as Firebase Realtime Database and Cloud Storage. You can re-use that ID token to identify the user or device on your custom backend server. To retrieve the ID token from the client, make sure the user is signed in and then get the ID token from the signed-in user.

(Reference: https://firebase.google.com/docs/auth/admin/verify-id-tokens )

Firebase ID token example

The above screenshot shows an example of Firebase Id Token (JWT) decoded by jwt.io

How to verify using jwt.io?


1) Paste Firebase Id Token and get the kid value


2) Go to GoogleApis website and find the matching certificate value


3) Copy and paste the certificate value (in plain text without "\n") to jwt.io website

4) You shall get the Signature Verification Status. (it means the token is verified as a true message that comes from firebase)




201704, 20170423, JWT, FIREBASE