0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【decodeJWT(無料)】JWT decode API【JSON Web Tokens decoder】

Last updated at Posted at 2023-03-06

Usage( 文法 )

toekn=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
curl https://jwt.deno.dev/$token

Example( 実行例 )

ウラル🏔( URL )

https://jwt.deno.dev/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

カール🐸( curl )

curl https://jwt.deno.dev/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

ジャバスクリプト🧉( JavaScript )

await fetch('https://jwt.deno.dev/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c').then(r=>r.json())

ぴぃえぃちぴぃ🐘( PHP )

var_dump(json_decode(file_get_contents('https://jwt.deno.dev/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c')));

ぴぃてぉん🐍( Python )

import requests
requests.get('https://jwt.deno.dev/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c').json()

うびぃ💎( Ruby )

require 'net/http'
require 'json'
require 'uri'

JSON.parse(Net::HTTP.get(URI.parse('https://jwt.deno.dev/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c')))

Output( 出力 )

[
  {
    "alg": "HS256",
    "typ": "JWT"
  },
  {
    "sub": "1234567890",
    "name": "John Doe",
    "iat": 1516239022
  },
  {
    "0": 73,
    "1": 249,
    "2": 74,
    "3": 199,
    "4": 4,
    "5": 73,
    "6": 72,
    "7": 199,
    "8": 138,
    "9": 40,
    "10": 93,
    "11": 144,
    "12": 79,
    "13": 135,
    "14": 240,
    "15": 164,
    "16": 199,
    "17": 137,
    "18": 127,
    "19": 126,
    "20": 143,
    "21": 58,
    "22": 78,
    "23": 178,
    "24": 37,
    "25": 95,
    "26": 218,
    "27": 117,
    "28": 11,
    "29": 44,
    "30": 195,
    "31": 151
  }
]

Source code( ソースコード🍝 )

import { serve } from "https://deno.land/std@0.177.0/http/server.ts";
import { decode } from "https://deno.land/x/djwt@v2.8/mod.ts";

const options = {
    headers: {
        'Access-Control-Allow-Origin': '*',
        'Content-Type': 'application/json'
    }
}

serve((req: Request) => new Response(JSON.stringify(decode(req.url.slice(21)), null, 2), options))

ライブラリインストール面倒くさいときに、ご賞味ください

参考

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?